#multiplayer
1 messages · Page 173 of 1
Same network but in session host config/search it is not lan
It's part of the ini, pretty sure you can find how to enable SteamSockets instead of SteamNetDriver online
ok
I only did that once for a customer cause they wanted the 9999 ping stuff to be solved
The PCs being in the same LAN should in theory not matter
I'm pretty sure I've tested with a laptop in the same network before
I know, if configured for LAN hosting/search it still is not finding
I really think the problem might have something to do with your code somewhere. I'm also using steam sessions for my project. Just a fee days ago in fact. It worked fine
But I can't really see how you have everything setup
That's an empty widget event graph
scroll down a little
Ah
https://blueprintue.com/blueprint/ee9p2w5n/ and the host one
I know that blueprint is ugly but I want it only to get work XD
fwiw LanMatches also need to be ListenServers
But that's besides the problem
I would try this same setup with the default, native nodes first
To check if that plugin is at fault
I told ealier - with native subsystem it worked
I only replaced nodes for advanced sessions steam plugin
Ah, sorry, must have missed that
docs said it must be with option like this one if hosting lan
I assume the hosting works, logs show that properly?
yes
LAN vs Internet has nothing to do with the Listen vs NonListen
For a Client to connect, it must be a ListenServer
LAN vs Internet only differs in how the Session Information is found
LAN asks the whole network
Internet asks the MasterServer of the given Subsystem (e.g. Steam)
are you talking about this?
I never used AdvancedSessions, so not sure if any of the values are maybe wrong
changed network driver for steamsockets, gonna test
How many Public Connections did you enter?
Also are you able to find your match when trying to search for games in the editor? That should work
Lsi
its 4 already
yes it works
So 4 Public, 4 Private?
I wonder if that actually means 4 of the Public Connections are Private.
And then your "Min Slots Available = 1" fails
Just a random idea though
ok I'll try this one also
Worth a sanity check yeah
The only time I've ever heard someone being unable to find sessions on steam using 480 was due to download servers being different, or steam was doing an update. Steams doing some update. Best of luck to you though, im out of ideaa
Yeah it's always pretty shitty when this happens
Most people have the best time when just using their own ID
But I totally get that this isn't always a thing someone is willing to commit to yet
after changing to steamsockes, public connections to 16, make sure it is same region - everything is ok and it do not work : |
[2024.04.14-18.31.11:007][195]LogSteamSocketsAPI: Verbose: SteamSockets API: Log Ping location: waw=8+0,vie=28+2/19+0,fra=20+2,ams=25+2/26+2,sto=44+4/28+0,sto2=45+4/28+0,par=28+2,lhr=32+3/30+2,mad=56+5/48+2,iad=116+11/105+2,gru=221+22,sgp=252+25/253+25
[2024.04.14-18.31.11:007][195]LogSteamSocketsAPI: Verbose: SteamSockets API: Log SDR RelayNetworkStatus: avail=OK config=OK anyrelay=OK (OK. Relays: 24 valid, 2 great, 10 good+, 15 ok+, 8 ignored)
[2024.04.14-18.31.13:696][429]LogBlueprintUserMessages: [WB_MainMenu_C_2147482470] Join Game
[2024.04.14-18.31.13:718][431]LogRHI: Display: Encountered a new graphics PSO: 1953013355
[2024.04.14-18.31.16:298][664]LogOnlineSession: Warning: STEAM: Unable to set search parameter LOBBYSEARCH: Value=true : Equals : -1
[2024.04.14-18.31.16:608][692]LogOnlineSession: STEAM: Found 0 lobbies, finalizing the search
[2024.04.14-18.31.17:505][774]LogOnlineSession: Warning: STEAM: Server response IP:15.228.203.218
[2024.04.14-18.31.17:505][774]LogOnlineSession: Warning: STEAM: Removed incompatible build: ServerBuildUniqueId = 0x00000000, GetBuildUniqueId() = 0x01a22caa
[2024.04.14-18.31.17:513][774]LogBlueprintUserMessages: [WB_JoinGame_C_2147482464] Finished searching for servers
[2024.04.14-18.31.19:329][937]LogOnlineSession: Warning: STEAM: Unable to set search parameter LOBBYSEARCH: Value=true : Equals : -1
[2024.04.14-18.31.19:660][967]LogOnlineSession: STEAM: Found 0 lobbies, finalizing the search
[2024.04.14-18.31.20:578][ 50]LogOnlineSession: Warning: STEAM: Server response IP:15.228.203.218
[2024.04.14-18.31.20:578][ 50]LogOnlineSession: Warning: STEAM: Removed incompatible build: ServerBuildUniqueId = 0x00000000, GetBuildUniqueId() = 0x01a22caa
[2024.04.14-18.31.20:587][ 51]LogBlueprintUserMessages: [WB_JoinGame_C_2147482464] Finished searching for servers```
LogOnline=VeryVerbose
LogOnlineSession=VeryVerbose
LogOnlineServices=VeryVerbose```
that's the way how to add it to .ini file, fyi
Hello there, Im encountering this very weird issue that I'm unable to create a session -or at least somehow.
Im using the Native online subsystem thats in the editor by default and whenever i create a session it reopens the current level.
Here is my log:
LogGameMode: ProcessServerTravel:
LogEngine: Server switch level: /Game/Maps/DefaultMap/DefaultMap?PktEmulationProfile=Bad
LogNet: Browse: /Game/Maps/DefaultMap/DefaultMap?PktEmulationProfile=Bad
LogLoad: LoadMap: /Game/Maps/DefaultMap/DefaultMap?PktEmulationProfile=Bad
LogWorld: BeginTearingDown for /Game/Maps/DefaultMap/UEDPIE_0_DefaultMap
LogWorld: UWorld::CleanupWorld for DefaultMap, bSessionEnded=true, bCleanupResources=true
LogSlate: InvalidateAllWidgets triggered. All widgets were invalidated
LogAudio: Display: Audio Device unregistered from world 'None'.
LogUObjectHash: Compacting FUObjectHashTables data took 0.70ms
LogUIActionRouter: Cleaned out [0] inactive UI action bindings
LogPlayLevel: Creating play world package: /Game/Maps/DefaultMap/UEDPIE_0_DefaultMap
LogPlayLevel: PIE: StaticDuplicateObject took: (0.001148s)
LogPlayLevel: PIE: Created PIE world by copying editor world from /Game/Maps/DefaultMap/DefaultMap.DefaultMap to /Game/Maps/DefaultMap/UEDPIE_0_DefaultMap.DefaultMap (0.001179s)
LogAudio: Display: Audio Device (ID: 6) registered with world 'DefaultMap'.
LogWorldSubsystemInput: UEnhancedInputDeveloperSettings::bEnableWorldSubsystem is false, the world subsystem will not be created!
I really have no idea whats the issue
thats all my code in blueprints
It does create a session, other players can find my session.
But for me it doesnt, its so weird
It doesnt open the AITestMap instead it reopens the DefaultMap
in options put "listen"
in open level node
I already tried that, makes no difference
do you have seamless travel enabled?
I tried with enabled and disabled, also no difference
but you should have "listen" in options no matter what because if you fix your primary problem your level won't start anyway
yeah well I dont know what to do anymore tbh.
The issue seems to be project specific
In other projects everything works fine
Don't test it in "New Editor (PIE)"
Use "Standalone Game" and tell me if it does work
It doesn't work in Standalone
Go in Advanced Settings > And Play with these 2 booleans until it works
Check "Launch Separate Server" and uncheck "Run Under One Process"
with these settings it works
but only if i play as client
no wait
it only works on client
no matter which booleans are checked
set the netmode to "listen server"
works too
then it should be good
hm, but why doesnt it work in standalone?
because listen server is what you need to create session
but it should also work in standalone too
only if you put listen in the options when opening a level
here
did you try it now after having that option + setting the settings shown above ?
yes
And also try Play Standalone + Standalone Game Mode
thats what it is by default, isnt it?
i dunno
well it doesnt work
And instead of OpenLevel rather use Execute Console Command like this by putting the argument servertravel + the name of your level
well in standalone it doesnt even reach the point where it opens the level
somehow the "create session" node reopens the current level
try what I showed above
with Execute Console Command
yes
if it still doesn't work, you can add this ?listen after the name of your map
it works ._.
but i dont get it, in all my other projects and also youtube tutorials it always works with "Open Level" and "?listen"
why not for me then
also around 1 week ago it worked with "Open Level"
I have no clue you will need to see with people more experienced than me because even myself I don't understand why it does that and it's really painfull 🤷♂️
I can't believe there is no solution for my problem, nothing in google search ;x
🤣 can relate
"I cant possibly be the first person doing this basic thing"
Often turns out my google-fu is just wrong😅
Especially with math problems where i lack the proper terms /descriptors
yeah, I wonder now if am I stupid or maybe using wrong terms, questions or soemthing other
Anyone here familiar with the new UMoverComponent? I'm trying to do ragdoll but I need some way to disable the mover component somehow so I can update the capsule location
I get some ensure throwing for the movers network prediction
Do spectators not count towards Numplayers in the game mode?
It does not. There is a NumSpectators integer that counts the spectators seperetely from NumPlayers in PostLogin of the GameMode.
void AGameMode::PostLogin( APlayerController* NewPlayer )
{
UWorld* World = GetWorld();
// update player count
if (MustSpectate(NewPlayer))
{
NumSpectators++;
}
else if (World->IsInSeamlessTravel() || NewPlayer->HasClientLoadedCurrentWorld())
{
NumPlayers++;
}
else
{
NumTravellingPlayers++;
}
//.... truncated
Why?
cant actually remember
my game mode, game state, player state are all different in the maps i travel to
That hasnt got anything to do with Seamless Travel
Do you know what its purpose is?
so that clients dont have to reconnect when host loads a new map
and host has to reconnect to i think
That part is correct.
This isnt. The Host is the Server.
A Host cant reconnect to itself.
Out of curiosity is game instance destroyed across non seamless travel?
No...
The GameInstance is basically the UE process itself.
Its lifetime is tied to the application
Has nothing to do with travelling
Going back to Seamless Travel.
There are very very few cases where you dont want Seamless Travel.
my setup is that i have a lobby where players find or host sessions, if you host a session you open a map select screen where other players can join your session
from the map select screen will i be able to seamless travel to any map in my game?
There are 2 types of travelling.
Seamless Travel
And
Hard Travel.
Hard Travels are any travel that occurs between Servers (if you disconnect from a Server and move back to a local level, that is a hard travel).
A Seamless Travel can only occur within the same Server and if it is enabled.
You cannot Seamless Travel between Servers.
If you want Clients to remain connected to your Server when that Server changes level, you want to leave Seamless Travel enabled (which it is by default).
just enable it in the 2 corresponding gamemodes (of each level)?
Yeah I cant remember why I disabled it
I did 2 tests one with it one without and it worked without up till recently
In 99% of cases you want to leave it enabled.
Thats why its enabled by default
There are very few use cases for it to be disabled.
ok got u
How do I figure out which player I am (listen server multiplayer). Like am I the first player to join or the second?
You can check the PlayerController for IsLocalPlayerController
The Listen Server Host will always be first.
oh, but what if there are like 4 players?
Just quick note, in GameModeBase (on 5.1.1) it's disabled by default, you have to enable it by yourself and I think that's also how it functioned back in UE4 🫢
I just checked and you are correct.
My bad.
Really silly that it isnt.
It really is cz now peeps are wondering why shit's not working when they forget that step
You need to provide more context around what you are looking to solve.
That information doesnt really change anything about what I said.
Basically I have two player starts. I want the first person to join to spawn at the first player spawn and the second to spawn at the second player spawn. I also plan on moving over the 1st player spawn to spawn a 3rd player if a 3rd player joins but I am working on step one. I have looked up every forum post and tutorial under the sun and none work.
I tried overriding choose player start but no matter what I do the player start tag always gets reset the next time choose player start gets run
if i do a server travel to a new map with not GM override, does the gm gets re-created as well as the pawn and controllers?
Can anyone help me with replication? Basically what I need is whenever someone clicks disconnect the game checks if they are the host or not through a boolean i set up and if they are determined to be the host its SUPPOSED to display Host Has Disconnected and then transition everyone to main menu from lobby and then destroy session, the Host checker works as whenever I leave as the host it says Host Has Disconnected, but everyone else doesnt get put to main lobby and im not sure if session is destroyed or not.
Another thing is the names, I tried to have it setup to where whenever someone joined their name would be put in the respective slot, this is working clientside as if host creates the session/presses play it puts their name to slot 1, if player 2 accepts the steam invite it puts their name to slot 2 but the names dont show up on eachothers screens.
Im not sure if my transition to main menu from lobby custom event needs to be a replicated mujlti cast call too? Everything involving the host is replicated multi cast so far and whenever player 2 joins its also replicated multi cast
Whoever is willing to help much appreciated, can ask any clarifying questions you need or any more screenshots
for which part?
Does HasAuthority return true for a standalone game? answer: yes. https://forums.unrealengine.com/t/hasauthority-returning-true-for-client/54394/9?u=nande
Yes
Player Controllers only exist on the server or the client that owns that player controller so using multicast on them is a bit pointless.
The way to check if a specific player controller is the host is to test if the player controller is locally controlled when you know for certain you are running on the server.
Is there a need for RPCs inside a gameplay ability? My gut instinct is yes because it's the GameplayEffects, Tags and Cues that get replicated right?
I have a gameplay ability that lets a player move a piece to a tile on (effectively) a chess board and the final location of the piece is not getting replicated, it's just completely decoupled on server and client. The AI controller and character movement components of the piece replicate fine. Other gameplay abilities have had their montages/cues/tags replicated without issue
You don't need to have the ability marked to replicate. If you have the ability marked as client predicted, that means it will execute the activation logic on both the client and the server. Effects, tags and cues can be replicated seperately from the ability itself.
If you happen to have the ability marked as "Client Only" or "Server Only" then it will only execute its logic on the client or server.
When you mark an ability to replicate you are effectively enabling it to send RPCs and set replicated variables, but this is largely unnecessary as most of these things are handled through other systems such as effects, cues and tasks.
Right, I think all of my replication settings are in place. It's just specifically this attempt to SetActorLocation
First is server view, second is client view
Are you connecting through a session or something before this? The windows are showing you're using standalone netmode.
Good catch lmao, I thought I broke something new and just went with it. Server view, client view with server moving, then client view, server view with client moving
Ok, now the next problem is that the Player Controller's hit result under cursor isn't something that is sent by the client to the server automatically, even through a gameplay ability. This would likely require some target data being sent to the server through a targeting task.
So this part here, the cast would fail on the server as the server doesn't know what is under the client's cursor.
Ahhh brilliant, that also explains why it had the same behavior when I moved it out of a gameplay ability and straight into the Player Controller
Thank you so much, I'll try to fix this and report back 
Hi,
For movement replication, is it better to use SetReplicateMovement(true); or Mesh->SetIsReplicated(true); ? Both work.
For scale only the latter works.
Or is it advisable not to set replication on the mesh, and do scale replication yourself?
NPP has smoothing for SimulatedProys on FixedTick, but not for the AutonomousProxy.
You'd need to add that yourself.
how to exclude a plugin from the client build? since only the dedicated server uses it
Buh, I don't think I ever excluded a Plugin from a build specifically. Maybe via the Target.cs files?
I fixed my issuse with not finding sessions, I posted solution in the correct channel #online-subsystems message
My next question is if is it possible to test mp "standalone" option in the editor? I assume no. So if not there is a quick way to dissable steam sessions to use native on to test it in editor properly?
Steam is automatically disabled in editor
I mean this option
You bigger issue with pie is that you can't properly test Seamless Travel
Ah you want to do standalone but without steam?
yes, because every small change will force me now to package the game and test on secnod pc (which is lottery for now because it fails sometimes don't know why)
Why do you need to test Standalone so often though?
Most of the actual Gameplay can be tested in the Editor by just being on the map that you wish to test and starting as PlayAsListenServer
You'd only really need Standalone if you do in fact want to test something for Steam
Or if you want to test SeamlessTravel fwiw
I think what you could do, if you still want a quick nosteam standalone version, is to make a quick .bat file and adding -nosteam at the end of the path
All my seamless travel problems went away once I had the map that I'm traveling to not have the same PC as the one I was coming from.
Ok I'll try then
yooo it works, perfect!
am i right that anim notifies fire on both client (player controller who owns the pawn using the mesh with the anim BP) and server?
but not on other non-host clients
and on host they just fire once
since client = server
Anyone Know why when I use transfroms of the components I get Hand lag but using the components directly I dont. Need the transfroms as Im trying to replicate there positions to clients.
hello, someone can suggest an approach to solve my issue?
this is a line trace component send at a 0.1 sec delay( not tick) in a multiplayer game with client server, i notice that with this disposition i can get the cast of server side working, but not the client one that returns null.
the client one is the bottom flow.
even if the get owner don't work with client, someone can suggest a different approach?
this is a component for character, so there are no rpc ( i think it's not needed cause all player own it's own character)
thanks
Hello guys! I'm struggling with Seamless Travel... Currently, I connected my clients to my server (session looks good and replication in gameplay too). In my lobby map I have a start button to start the game, this button lead to a console command "servertravel L_Gameplay". I've set a TransitionMap in my project settings and checked the box for seamless travel in gamemode. I'm playing in Standalone but when I travel it's doing a Hard Travel. Can anyone help me with this?
Hi,
We have a gizmo in-game that's client authoritive. Even if we turn off ReplicateMovement when the gizmo is active, we get updates to our component from the server, even though OnRep_ReplicatedMovement does ignore the server's updates
Anyone knows what else can affect the transform from the server?
game mode cant replicate but can it receive replicated information?
?
can i move replicated information from game state to game mode
can game mode understand replicated information
what does this even mean? if you're dealing with the server, which you would be in game mode, then you know about every actor's state
including the game state
so yes?
well yes, but I'm confused as to why it was ever a question
I'm not sure why you're explaining that to me
Sry wrong msg to reply to
How is "replicated information" any different from normal information? Data is data, once you have it on the server (in the server version of gamestate i.e.) you can do w.e you want with it locally, that question is phrased in a very confusing way 🤨
It might be an incredibly naive misunderstanding of replication I suppose
You shouldn't care about the display name for the logic. The display name can vary between client and server and isn't a great way to check for anything.
You may be getting to the cast failed message as player controllers don't replicate to all clients, but this trace function could be executing for all characters on all clients.
Instead, try maybe an "IsLocallyControlled" off of the Instigator, and don't try to use the player controllers. This way you should be able to tell if you're running on the server or not and whether or not the pawn you're checking is the one that is controlled by the local machine.
Hi, i would like to replicate subobject using bReplicateUsingRegisteredSubObjectList, but is there a way to enable it from subobjects directly ? Since it's protected ?
Oh, maybe GDefaultUseSubObjectReplicationList
Is this switch on net a viable solution to have my anim BP use a different transfrom depending if its local to a player of on the server , need to use the replicated value for other clients to see across the network and use the direct ref for each players own hand locations,
Or Should I be doing it like this ?
After testing seems second was the solution
Is it possible that when accepting the invite and joi nsession is ran that it is creating its own lobby?
like maybe somehow join session fails to join the invite but makes its own session instead?
only thinking this because when i accept invite on the alt account/VM somehow the invitee has HostAuthority since its putting the steam name into slot 1
Hello, I'm encountering an issue with my HUD. It's functioning perfectly fine on both the server and the client. However, there's a bug with my stamina variable. It decreases correctly on my HUD when I use it and increases when I stop using it. But here's the problem: the stamina variable on the client side reflects accurately on the HUD, but its actual value doesn't update accordingly. So, my client indicates that the stamina variable is at 0, while it's not actually at 0 on the client's HUD. Does anyone have any ideas on how to fix this? Thank you.
what im ean by slot 1
No. If how your lobby system is working is based around your much earlier screenshots, it more likely has to do with how you're using RPCs (mainly multicasts) to drive the state of what things are supposed to look like. Multicasts are fire and forget. If clients aren't connected at the time the multicast is fired, then they would never receive the update. You also appear to be crossing wires across RPCs too which doesn't transfer the value from one call to the next, it'll be whatever value the current system has which could be the client's own value, not what the server wants to tell the client it has.
Stateful things are supposed to be handled through Replicated Variables and use of RepNotifies, or just using appropriate events for when things actually happen rather than relying on the server throwing multicasts.
For example, when a player joins a game, whether on the server or client, it can be known about by using the PlayerState's Begin Play event, so you can use that Begin Play to start driving some logic about a player joining the game, like say, adding a widget for that particular playerstate, and utilizing the playerstate reference itself to retrieve data to present in that widget. On that begin play, you can verify you're running on the authority and if so, that means you know you're running on the server, and you can then check if the playercontroller is valid and if it is "locally controlled" and if so, that means it is the server's playerstate, and then set a replicated variable on that playerstate to indicate that playerstate is the host's playerstate. If you do what I've pasted below, you could then use the playerstate to create a widget that you pass in a reference to the playerstate it is meant to represent, and then have a binding that reads the "Is Host" variable of the associated PlayerState of that widget to know if that widget should show who the host is.
Additionally, you can't use RPCs within widgets, so you shouldn't even have multicasts and the like within them, they just won't work.
Want a player to be able to update their name? Store it as a replicated variable on the PlayerState. You can again then access the name VIA a PlayerState reference that could be within your UI or even from your Pawn.
Hi, I am running into a very annoying issue that I can't seem to wrap my head around. When I am running in the Editor I see 0 issues for the client and server to communicate. But when I build the client and server and run the binaries I am seeing a "Mismatch Read" for one of my RPC functions. I am new to Unreal and this is far above my knowledge level. The client and server build are for sure built from the same code base and the argument the RPC takes is a String that is serialized on the Server before sending. Anyone here recognizes the issue and could point me in the right direction? 🙏
Issue only occurring outside of editor:
Error: ReceivedRPC: ReceivePropertiesForRPC - Mismatch read. Function: CLIENT Set Quest States, Object: BP_QuestComponent_C /Game/Maps/Largee.Largee:PersistentLevel.BP_PlayerCharacter_C_2147481919.QuestComponent
That is the only information in the output, and I am certain the string is not malformed or anything when sent from the Server, I am logging it.
Ah i see, yeah i scrapped the is host variable and decided to just use has authority instead, i do have the playername stored here but this is in the controller so its probably wrong. Should I use has authority with an is host variable like you showed? i thought it would automatically determine if player has authority or not based on if they created session or if they just accepted the invite
this is how ive changed it to retrieve playername variable and it plugs it into the ui, probably needs changed too
I know it's a kinda complex topic but I am trying to do predicted projectiles thrown from a first person view. in the research I've done it seems like the best way to do it for me is to have a fully fake projectile on the client and a real one on the server that the fake one syncs up with. My question is what's the best way to translate that into unreal terms? primarily, how do I make it sync up with the server projectile?
the player name shows up properly if i were to create a session its just player 2 is either not joining or like you said my ui syncing is wrong
I also changed alot of the multi casts to run on server but i feel like maybe not all need to be rpc
If the event is within a widget, you can't run RPCs in them.
They are not replicated, they send no data to the server, they receive no data from the server.
They can read from other actors that are replicated however.
i'm talking like grenade throw speed
its a fast moving projectile with no gravity that explodes on hit but not nearly bullet fast
competitive unfortunately for my workload
hmm so its more likely my player is joining and my replication is wrong rather than my player isnt actually joining off invite?
Yep
Oh lordy - does anyone remember that trick to debug server in PIE?
I was thinking about doing something like that but not killing the fake and just keeping it the whole time it's flying
what do you mean
so would you do that by having client and server projectiles different blueprint classes
Running as client (so dedicated server) and breakpoint isn't tripping in Rider. I remember someone mentioning that you could add something so the breakpoint is on the server and not the client.
err, single-process pie can't skip breakpoints
if it's not hitting then the server isn't running that code or you're not using single-process pie.
also idk how much this changes the technique of doing it but I'm using GAS
I'd be very surprised if the server isn't running the code but the BP debugger hits on the function and allows me to advance past it and all.
so when the server one is spawned does it send an rpc to the client for them to start updating the fake
I have some variables on an actor/character, and they replicate to connected clients, but if a client joins late, the variable is null
I tried using the player state to store the variables instead but same thing
also how does this work with the visual not coming from the player's face but we would want the projectile to I think so does the client also have a visual one and a collision one that it's predicting.
but the projectile will visually come out offset from center screen but hit detection wise it should be in the center. is that handled with client version has no collision and is visual off to the side, interpolating to the center as it flies and server version is invisible with collision coming out of the face?
I threw together what I was preaching since my last message, about 30 minutes of work...
WBP_Lobby utilizes a "List View" to dislpay the joined players which you pass a PlayerState object into and uses "WBP_LobbyPlayerIndicator" widget. It also has a start button that will only show for the host, and gives a field for players to set their name.
WBP_LobbyPlayerIndicator is a very simple widget with a text field and an image to portray who the host is and their desired display name, using binds that read from the passed in playerstate.
The BP_LobbyGameState only has a couple of event dispatchers set up in it to allow an easy way for the lobby widget to know when a player joins or leaves the game.
The BP_LobbyPlayerState calls the event dispatchers in the gamestate, and sets the values for the player's name and if the server is running the begin play, sets its own playerstate as indicated as the host.
it's just the boolean i care about
I simplified it, this prints false even after being set to true. There is only one of this component entirely and it's valid.
oh wow, ok im going to try and implement everything youve shown and explained
Datura going above and beyond, as usual.
Anyone know why when I have two standalone games in separate windows the one which has mouse focus has a significantly higher framerate? I'm not sure how to fix this.
I'm not bottlenecking on my GPU or CPU so not sure why this is happening.
Depends
What is the nature of your projectiles, are they bouncy and chaotic or more like actual bullets (pretty damn predictable)?
they're pretty predictable. they essentially function like a rocket, go forward until hit a wall and explode
Generally speaking you will just Interp the fake projectile to the master when its replicated down to the Owner.
The UT Source Code does this.
While its very very old code, its still a relevant resource in showing how you can predict projectiles.
Is object replication order not guaranteed?
Fatal error: [File:D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp] [Line: 3240] Object B None created in BP_ThirdPersonCharacter_C instead of A```
Object **A** is created in **BP_ThirdPersonCharacter_C** and Object **B** is created in Object **A** on server side
I had no issue until I did some changes, Not sure which change caused the issue so far
Will have to redesign if the order is not guaranteed but wanted to ask before making a decision, Thanks!
uncheck use less cpu in background in project settings
its not exactly called that but something like that forget the exact name
You should never assume Replication order is guaranteed.
Already unchecked use less CPU in background.
yeah when i first had that problem and unchecked that it didn't work either then one day it just stopped doing it
That's weird. Were you using two separate standalone windows outside the editor?
yeah
I saw a suggestion to override the viewport class and change some of the settings.
do you have two monitors?
Ya
I think that has something to do with it but not sure.
unchecking that was the only thing I really found for that issue
online
I wonder if it's related to the engine version.
possibly. what are you on?
I think it did it on 5.2 for me
maybe 5.1 don't remember
Not sure whay I can't rotate the mesh on the server but I can rotate the whole character, would be fine but rotating the whole character is causing my character to spin when playing as standalone or listen server .
Probably cause the Character Movement Component modifies it
So why would the mesh not rotate, on the server, and is there anyway I could prevent the set actor rotation on the server messing up the single standalone character. I already tried to change the locally controlled flow but didnt solve it.
Idk what you mean with the "Messing up standalone"
You'd need to properly explain the issue
Basically the set actor rotation is causing my listen server character to constantly spin like its caught in a loop. because the mean vector of the of my motioncontrollers and camera are creating a rotation vector for the torso arrow which is how im setting the mesh rotation, I Have 2 possible solutions either prevent the server actor rotation from affecting listen\stanalone characters or find a way to just also rotate the mesh on the server which would be preferd but that does not seem to be working
to get an item from an array on the server do i pass the index to the server?
Are your client and server characters spinning constantly, or only the client characters?
Steam sessions for linux not working I dont find any session grrrrrr
4.27 steam sessions plugin not working in editor for both windows and linux
We will have to switch to dedicated server
playing as client in the editor is fine. its when I play as listen or standalone that it spins, Im sure Its a loop of trying to rotate the actor to the arrow thats being rotated by the actor, I need to understand why I cant just rotate the mesh like i do on the clients. I did it in exactly the same way I did the other values. but it nerver rotates.
if it is editor, are you sure steam OSS is active and not Null OSS (editor forces null on non-standalone pie)
So when you play as listen server, both client and server characters spin?
I'm just asking to clarify if it only affects either the host or a client/connected player, and not both the same way.
Did you check if the server gets the correct input data when trying to rotate the mesh?
It not being done on input But updated from tick
Sorry, I mean input as in the variables like mesh and rotation going into the Set World Rotation node (on the server, like you tried earlier before using Set Actor Rotation).
Yes tried all that . nothing seems to make the mesh rotate , only the actor, And I would be fine with that But as soon as im on either standalone or listen server that causes the character to endlessly spin
Does it spin if you only rotate the actor locally and not on the server?
If not, you could set the actor rotation on the server with a RepNotify with Replication Condition Skip Owner/Simulated Only.
when i test-run my multiplayer game in editor, main-window client is working fine, but second one is have an errors
when i chose a character and a team in a main test window first, and then do the same for a second client - all is working fine
but, if i chose a character and a team for a second client before i chose it for a first client - the second one (client 2), in a small window, has an errors
how its can be?
they run same logic, net mode is "play as client", so they should be the same
what i need to do additionally for a second client?
Without code, not easy to answer
So Im sending the world rotation of my mesh to the server . which is what Sets the actors world rotation, works fine!.. But I dont know why it wont work on just the mesh.
i hope its fine?
https://blueprintue.com/blueprint/y2ptb7iu/
whether it's good or not
(NetProfile)
someone can help?
Is it a problem if I enter the "net update frequency" value of my car pawns as more than "100"?
For example, what kind of problems would I encounter if I set the value to 1000?
Actors won't be checked for replication changes faster than the NetServerMaxTickRate for dedicated server (for listen server I don't know but probably clamped to MaxNetTickRate). So increasing beyond those values will make no difference.
Defaults for those are 30 and 120 respectively
Did this and it helps a bit, Now Playing as client1, client 2 see's my character rotating , and if I play as the listen server Im not spinning anymore , But client 1 can't see my character rotating.
You're using "Get Player Controller 0" which could be part of the problem. Unfortunately BlueprintUE doesn't show you the type of RPCs you're using so it's hard to discern whether or not this would actually be a problem. As you're working off of the character, you can get its controller (screenshot below) rather than using "Get Player Controller X". It's best to avoid the "Get Player X by Index" type of getters in multiplayer as you can't always guarantee that it's the player you actually want to get.
Would you be able to post the errors you're receiving?
I don't know much about this subject, but as a result of my experiments, when I set the "net update frequency" value to 1000 or 1500, the client pawn does not flicker.
Vehicle mechanics do the same for server and client, I don't experience any vibration or motion synchronization issues.
Ok I think you should find out why it's flickering as that's definitely not right!
Vehicle mechanics never work properly for multiplayer for unreal engine. This is the only way I could solve the flickering problem.
thank you, i'll check it tomorrow
I mean you're not gonna get 1000 updates about any actor per second so whatever you've done there isn't going to work in the real world
Hi all, I'm encountering a very annoying issue where my server is crashing when using a cooked server & client with alot of Blueprint RPCs, but never in the Editor. I don't have any warnings or errors when running in the editor (play as client) which makes me worried that this is extremely hard to debug. The error is shown in the snippet below. Does anyone have experience of this, or knows how I could extract more information about the crash than I am receiving now ?
The only error output:
Script Stack (0 frames) :
[2024.04.16-20.55.22:152][347]LogWindows: Error: appError called: Assertion failed: this->PropertyClass [File:D:\UEVersions\UnrealEngine-5.3.2-release\Engine\Source\Runtime\CoreUObject\Public\UObject\UnrealType.h] [Line: 2821]
I am new to Unreal and in my desperation I am now rebuilding the engine by adding some logging to that method, no clue if it will work though..
virtual FString GetCPPType(FString* ExtendedTypeText, uint32 CPPExportFlags) const override
{
// adding som logging
if (!this->PropertyClass)
{
if constexpr (std::is_base_of<UObject, InTCppType>::value)
{
const UObject* Obj = static_cast<const UObject*>(this);
UE_LOG(LogTemp, Error, TEXT("PropertyClass is nullptr. UObject Name: %s"), *Obj->GetName());
}
else
{
UE_LOG(LogTemp, Error, TEXT("PropertyClass is nullptr and 'this' is not a UObject."));
}
}
// end of logging
check(this->PropertyClass); -- THIS IS WHERE IT FAILS --
return this->GetCPPTypeCustom(ExtendedTypeText, CPPExportFlags,
FString::Printf(TEXT("%s%s"), this->PropertyClass->GetPrefixCPP(), *this->PropertyClass->GetName()));
}
Any help appreciated!
Calling a function on a nullptr would be my bet
Attempting to debug this is a non-debug build is borderline useless. Cook the game then run it from VS in DebugGame mode or something
Should also get a callstack too which will show what leads up to it
That sounds like what I needed to know, I'll just run the Server in debug from VS and then run some clients using the client binary I guess?
Alright, I'll try it. Thanks alot!
Is there a way to override an on rep notify for a child's variable?
Or do I need to move the whole var to the child?
Or maybe the on rep calls a function, which only the child has. Is there a better way?
You can make the OnRep virtual
Assuming that's what you're asking anyway
sounds slightly cursed either way
is this FPS independet movement ? when delta world seconds multiply is at the end right before setting location or nah? because I have feeling like when I play it with lower fps I am slower
Yep that was not very helpful 😆
[2024.04.16-22.24.22:592][553]LogTemp: Error: PropertyClass is nullptr and 'this' is not a UObject. // lol
[2024.04.16-22.24.22:592][553]LogOutputDevice: Warning:
Script Stack (0 frames) :
[2024.04.16-22.24.22:602][553]LogWindows: Error: appError called: Assertion failed: this->PropertyClass [File:D:\UEVersions\UnrealEngine-5.3.2-release\Engine\Source\Runtime\CoreUObject\Public\UObject\UnrealType.h] [Line: 2834]
DebugServer here we go
is this being called on tick?
assuming that is being called delta seconds apart, it should be framerate independent
it is on tick, but i am now thinking if i should not move all functions which are on tick to timers because there is really a lot on tick, yea it should be independent but I tried game on low end laptop and i had feeling like on 30 fps it was slow idk how measure it
Tick is fine if it's something that should be updated every frame, which location very much is
yea there is speed, location, and replication
how is speed being changed?
u can change thrust by ctrl (down) shift (up) 0-100% also when u fly down /up u decrease increase speed by time , or u think something different
its complex, there is air density, thrust, net force, pitch adjustment,+ gravity, and at the end I am putting it like this and its on tick
was thinking use event timer for it instead tick
then timer should be same for every computer even with low fps
your math is all over the place
Tick -> calculate acceleration -> calculate new velocity -> calculate new location
do it in that order, using delta seconds when integrating from accel to velocity and velocity to location
and use vectors the whole way to make things easy
Still haven't seen where Speed is set
here
ok that looks correct
I'd still reformulate to use vectors though, it'll be a lot simpler
Acceleration = All your math and stuff
Velocity += Acceleration * dT
Position += Velocity * dT
I am using OnRep_PlayerState to set player names, but it seems that simulated characters do not have a valid widget component at that time(during OnRep_PlayerState), when do components become valid on simulated proxies?
Does anyone feel like helping me? I really don't understand RPC's. I've watched several videos and read epic's documentation but this is proving a bigger sticking point than I would have thought.
looking into the actual code of making this, plan was to make a child of the projectile movement component with the ability to blend into the location of the real replicated projectile. but looking at the code theres a bunch of projectile movement interpolation stuff, is that at all what I want?
You'd tell the Server about Array first after connecting to it. You can do that for example via your PlayerController. In its BeginPlay you could check for IsLocalPlayerController and then send a Server RPC that passes the Array from the GameInstance along. You'd then need to set it somewhere where it can replicate. For example in the PlayerState of that Player. The variable in the PlayerState would need to be set to Replicate to make it to the Client.
how do I send a Server RPC? Is it a custom event with the replicates setting set to Run on Server?
Yes. Did you read the compendium?
reading through ue replication docs
(for example an fps game), server would only need to be sent projectile data when shooting a gun, and a client would take that data and do the rest (like spawn sounds, bullet hole decals, etc), right?
and of course hit events would need to be run on server then sent to clients?
ping me please
how good is the GAS replication? Is it rollback? Is there a relatively easy way to do server validation for state machines? or should I look into other avenues for netcode? I only have a bit of experience with game networking and that wasn't particularly low level, although I have coded animation variable serialization/deserialization myself in the past (not in UE5, and it was just encoding/decoding to and from a buffer that went into a packet, not the actual networking stuff).
I don't really want to have to do netcode myself unless I absolutely have to because it seems like a pain and might involve making plugins to interface with external libraries.
@hearty dune Not as simple to answer tbh. It's probably useful to draw three (horizontal) timelines for Server, OwningClient and SimProxyClient version.
In most cases Owning and SimProxy might be the same for a Projectile.
There are several events during the lifetime of an actor that are calling on all 3. BeginPlay for example, or Tick. As well as CollisionEvents. Those happen naturally due to the Projectile colliding on everyone.
There are parts you may want to only do on the Server, such as applying Damage. There may be parts you may want to also do on the Clients, such as spawning Effects.
Without some more involved prediction system, if you simulate the hits on the clients for effects, you could always run into the situation where they show a hit but the server missed. But you get instant feedback. If you want the feedback to be true all the time , you could multicast the hit to clients, but that adds a delay of course.
You gotta think about this for a lot of things, but this is the first few thoughts
GAS uses UEs built in replication. You usually don't replace that but rather tell UE how you wish to serialize data if you want to improve bandwidth.
GAS itself also has some prediction built in with some rollback for side effects (such as gameplay effects that were predictively added), but it's not as strong as it could be. There are a few things you can't predict and if GAS has to sort of work with another simulation, such as the CMC that has its own prediction system, you will get a bit of a headache. But that is true of a custom system you'd write too.
any advice on making GAS play nice with CMC?
If you want to go custom, I would suggest looking into the NetworkPredictionPlugin and making a custom GAS system as a Simulation there, and use Mover for movement instead of the cmc. However, this is in its early stages and needs some additional work to go smoothly
Not really. There are some solutions, but none are really simple like flipping a checkbox somewhere
Problem most people will face is using an Attribute for speed, or Stamina
CMC wants to run all of this through its ServerMove setup, with saved moves to replay on corrections etc.
GAS attributes aren't part of that, and altering them via GEs is only partially predictable
yeah part of what I'm specifically trying to achieve is making things like stamina server-validated
It's a pretty common thing, but last time I asked, even Epic didn't have a solution for it.
Not strictly multiplayer, but does anyone have any experience with Mover and demo playback? It just instantly crashed for me because it's trying to send a loading archive, rather than receive it.
how do i get delegates to work in multiplayer, the delagates are only happening on client and it doesn't get bound in multiplayer but works fine in single player
What is the currently recommended approach to storing players' sensitive data such as the amount of gold, equipment in multiplayer games?
Is updating this type of data through HTTP API calls by VaRest a sensible approach? And update dynamic data like health, stamina already on the game engine side?
Why would an http api call be better than a game engine channel?
You don't have to send all data to all players.
so what excatly do you recommend?
Put the data on the player state and mark it to replicate to the owning player only.
delegates have no multiplayer-specific functionality
not even client only delegates? what else should i use
what do you need to do
idk, player state storing data only for active session. So what is the next step, where can I store my data after logging off from game?
binding to a function refresh when a replicated variable changes, specially in client ui
so broadcast from OnRep?
also from server code you would have to manually call the OnRep after setting the variable
in C++, BP handles that for you
Handle that on your server. Your player should never be updating their own "sensitive data" like how much gold they have.
How you handle it on the server is up to you.
functions arent getting bound when running on listen server so cant broadcast
so where are you binding
in client on a ui element
yes details please
what creates the UI? where in the UI element?
is the thing that contains the delegate valid?
did you debug this?
And just to be sure, you aren't expecting a ui element to bind to a function on the server from a client or vice versa?
did you verify the broadcast is even triggered? you can broadcast a multicast with an empty invocations list
so many questions, but first it works fine in single player so it binds fine and broadcasts fine
im only trying to do it on client side nothing on server
well UI is only on the client, so yeah
you need to show this setup, as well as the broadcast end
the tick is running only on client here
I have an actor which is SetIsReplicated = true; and have some components like StaticMeshComponent and Box Collision in this AActor, so spawning this actor doesn't replicate the static mesh but it replicates the Collision box
what can be the issue?
UPROPERTY(VisibleAnywhere)
UStaticMeshComponent* PickupMesh;
UPROPERTY(VisibleAnywhere)
UBoxComponent* OverlapDetectionBox;
APickupBase::APickupBase()
{
PrimaryActorTick.bCanEverTick = false;
PickupMesh = CreateDefaultSubobject<UStaticMeshComponent>("PickupMesh");
PickupMesh->SetCollisionProfileName(TEXT("NoCollision"));
PickupMesh->SetupAttachment(Scene);
OverlapDetectionBox = CreateDefaultSubobject<UBoxComponent>(TEXT("BoxComponent"));
OverlapDetectionBox->SetBoxExtent(FVector(40.0f, 40.0f, 10.0f));
OverlapDetectionBox->SetHiddenInGame(false);
OverlapDetectionBox->SetCollisionResponseToChannel(ECollisionChannel::ECC_Pawn, ECollisionResponse::ECR_Overlap);
OverlapDetectionBox->SetupAttachment(Scene);
SetReplicates(true);
}
really wasn't anticipating a tick function with this
its temporary i followed a tutorial for grid inventory and now converting it to replicated
doing the replicated part after the fact always ends in tears
does the if condition ever hit if you add a breakpoint and run as a listen server?
havent debug the code, just print stringed it and else only shows
print debugging is also another way to deliberately handicap yourself
rather than using the actual debugger
and on the BP side, the screenshot is a little too overcropped
and did you breakpoint the binding to see if the inventory component is valid?
yeah its is validated
if i set set is replicated for PickupMesh then it replicates, else the static mesh don't show on clients
but OverlapDetectionBox don't need set is replicated, it replicates without it
confusing
i test these nodes, as u say, and case is solved
you are absolutely right about it
thank you again, big bro, great advice, as always 👍🏻
Most likely, the delegate isn't your issue. The OnRep is. OnRep normally only runs on a client and is avoided on the server machine. This is unfortunately annoying on a listenserver. So you have to do some extra code to handle it.
{
SomeVariable = NewValue
if (GetNetMode() != NM_Client)
{
MyDelegate.Broadcast();
}
}```
```void MyOnRepThing()
{
MyDelegate.Broadcast();
}```
why you replicating mesh components and collision boxes?
the client should spawn the same actor if you have a static mesh set on the actor
i am spawning the replicated pickup actor on game mode when the game starts
keep in mind that the game mode does not replicate to other clients
usually you would replicate something like a pickup type on the individual actor and then the client can deduce what it's supposed to look like
a wild guess here, is the meshComp set to replicate? not sure if that would make a diference if the parent is set too replicate
problem is not with the actor, problem is with the child componens of the actor
usually you should grab the mesh and materials etc... from a data asset or something like that and provide an asset reference or index to grab that from the client side
if the actor is already spawning and a collision box is shown by all clients, the pickup mesh should also replicates i think
that should be the case
but it is not replicating
you generally don't replicate this
are doing anythig to it in code? does ur actor have logic to hide it or something similar? have you tried this on other actors?
replication is getting the message to the client by saying as little as possible
so in this case, sending the pickup type, whatever it is, if it's in a DA or whatever, send that, and then the client can figure it out on their end
both collisoin box and pickup mesh is set to not replicated by default but the box colliiosn repicates and the pickup mesh not replicates
and why would either need to replicate, ever
make a new bp with the same components that you have on the faulty one and spawn that BP see if you can see the mesh, if you can see it than its probably a "my code is doing bad things" issue
I tried to replicate the ID and Type of the item, still not replicating to all clients the pickup mesh
so yeah you have the right idea there
Apart from an actor component, other stuff attached to an actor probably should not replicate.
meshes, materials, etc are accessible to both sides
so when the client knows the type of item (through an OnRep or whatever), then you can set the mesh clientside
since it knows what type of item it is
there shouldnt be the need to set anything, if you spawn an actor on the server and it replicates it should appear on the clients
void APickupBase::InitPickup(EItemType NewItemType, FText NewName, FText NewPrefix, UStaticMesh* NewStaticMesh)
{
if (GetLocalRole() == ROLE_Authority)
{
Init(NewItemType, NewName);
UI_prefix = NewPrefix;
ThisItemType = NewItemType;
ThisItemName = NewName;
ThisItemStaticMesh = NewStaticMesh;
PickupMesh->SetStaticMesh(NewStaticMesh);
OnRep_InitPickup();
}
}
void APickupBase::OnRep_InitPickup()
{
// Call the parent class Init function to ensure proper initialization
Super::Init(ThisItemType, ThisItemName);
// Set the static mesh on the client side
PickupMesh->SetStaticMesh(ThisItemStaticMesh);
}
this is how i am initializing the pickup when it is spawned by server
from itembase
void AItemBase::Init(EItemType NewItemType, FText NewName)
{
ItemType = NewItemType;
Name = NewName;
}
give that pickup meshComp a default value, comment that "setStaticMesh" and see if the problem is there
already tested, it works fine if i set a mesh by default
yes i logged it
have you check if "thisItemStaticMesh" is null?
no checked but on server it is shown
it might be null on the client
also check the transforms
you might have a weird transform going and the mesh might be there just very small and you cant see it
just guessing here
i ejected in the game checked the spawned actor, it has an empty static mesh
😄
logged it? just use the debugger
your probably not setting that var on the client that would be my guess
UPROPERTY(VisibleAnywhere, ReplicatedUsing = OnRep_InitPickup)
UStaticMeshComponent* PickupMesh;
why does that have replication?
setting it on on-rep
void APickupBase::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME_CONDITION(APickupBase, PickupMesh, COND_InitialOnly);
}
well you should consider ThisItemStaticMesh or something instead
im not sure if i am correct on what im gonna say but, that thing is not replicated, so its never gonna call that on_rep?
even if it were, on rep is only called on variable changes, i dont think a mesh is ever going to change
so the on rep on client shouldnt even be called
i might wrong tho
the component isn't going to change
this is the server's perspective
thats what i was gonna say
but i think if it was being called on the client it should hit that breakpoint twice no?
how do u know its the server's perspective?
yes, though that's why you add {,,UnrealEditor-Core}::GPlayInEditorID and UnrealEditor-Engine!GPlayInEditorContextString to your watches
like all of the callstack?
ye, nvm its calling the game mode lol
@nocturne quail ur probably going about your solution the wrong way
what the correct way 😄
like I haven't given you a very explicit suggestion
UI_prefix = NewPrefix;
ThisItemType = NewItemType;
ThisItemName = NewName;
ThisItemStaticMesh = NewStaticMesh;
any of these i can use instead?
though I wouldn't replicate the static mesh asset itself (over the network, it's the path to the asset), I would replicate what kind of weapon is, and then figure it out on the client
but you can
you would have to explain the problem, i dont know if u did before i just got here lol
i will now try to use ItemType in onrep, if this not solve the issue i will write a detailed note 😄
replicating type doesn't works and i tried ThisItemStaticMesh and now the mesh replicates
UPROPERTY(ReplicatedUsing = OnRep_InitPickup)
UStaticMesh* ThisItemStaticMesh;
Thank you to everyone who has been helping me with my questions on the engine. I have finally completed a working prototype of my multiplayer game and am quite happy about it. While I begin creating the models and animations for the game I still have something to inquire upon. Do I need a server list, and if so the reasons why.
Hello everyone, does anybody know a way to force the server to trust the client when it comes to collisions? I'm making a plugin for procedural world generation where the mesh of procedural world only exists on the client to save bandwidth, but because of that clients just fall right through it since the server doesn't allow a mesh only existing on the client to manage collisions
theres some options i think, let me see if i can find them
GetCharacterMovement()->bIgnoreClientMovementErrorChecksAndCorrection = true;
GetCharacterMovement()->bServerAcceptClientAuthoritativePosition = true;
see if these work
also u can spawn those meshes on the server without having them replicate and also spawn them in the client in the exact same place, you would have the collision and save the bandwith at the same time
Ok, thanks a lot! I think I'm going to try the second approach first because it looks more safe when it comes to cheating (although anti-cheat is not high priority for my project)
Can I get a sanity check on how I'm planning on organizing? Project is a TFT-like game, basically 30 seconds to buy units from a shop/place them on a board, 30 seconds where you're matched against another player and the units fight. I feel like the Game State can/should be doing more?
I'm also not sure where I should handle the actor pool...the Buy Unit function will be called from the UI, so that'll be a server RPC that will decrement the cost from the PlayerState, then the Game State will handle pulling the actor from the pool and placing it on the board? Or the Game Mode? I'm not really sure
The teams in my multiplayer game are not working. It works fine in the editor, but once I package it and try it on multiple devices, the teams no longer work. The teams are split into two, blue and red, but when I package and send my to other devices, the blue team is normal, but the other players do not have a team, causing their material to be the no team material. Here is my code.
Character cpp: https://dpaste.org/cNMXZ
Character h: https://dpaste.org/S5ZJL
Gamemode cpp: https://dpaste.org/Y3SOS
Gamemode h: https://dpaste.org/jHq5F
Just... what??
The host can see their own weapon when they pick it up but the other clients can't see the host holding it, but if one of the connected clients pickup their weapon, they can't see it themselves but the host can see them holding it.
I am so confused as to what the issue could be, I have set the component to replicate and the code that sets the static mesh component to visible runs on the server.
Hey, thought about this today, probably a really easy answer. Should you delete server code in the client for dedicated server builds? or is "is dedicated server" "switch has authority" good enough to prevent cheating?
why do you keep deleting and asking the same question? and please only post relevant parts
hello, i know this is an old post but i ran into a tangential issue similar to this. I saw you mentioned pre written data assets and data assets that you have somehow managed to create at runtime. while i do not need them to be replicated, i am stuck on how i can create data assets at runtime. could you maybe point me in the right direction? thanks in advance, and sorry if im bothering you 😅
if you have any other solutions to this problem of storing data related to assets created at runtime, i would love to hear that as well!
Is it possible to servertravel using this node?
I'm async loading the level and only want to travel when all players have preloaded the level
Yeah so you won't be able to send them across the network since they're data assets which are tied to your local on disk location, you have to architect it where it is deterministic with you creating a copy and and based on data that you pass across the network, you modify that copy with it. Or do a different solution entirely.
Sorry misread that, you can simply use the DuplicateObject function that the engine provides
Just be aware that this is considered a regular runtime object instead of a data asset at that point
ah, so impossible to serialise?
Yeah don't try to do that
treat it like its an actor you spawned at runtime basically. Nothing is definite, try to make it as deterministic as possible and being smart about using a minimal amount of data(only stuff you need) when serializing it
hmm, all i really need in the data asset is a bunch of soft references to some static meshes, a bitmask flag, a few assorted primitive variables and a single custom structure. i guess i could nest all of that inside another struct. Problem im thinking of right now is that i am also using the data registry module and iirc that depends on data assets directly, not just data tables
Yeah I dont recommend storing anything but primitive types(not soft pointers or anything referencing other assets) in data tables because it wrecks projects regarding asset loading...
This makes me want to ask why are you creating a runtime data asset? My reasoning was because of static data from a backend server which would have each element not be something I could find on disc locally...
Data Assets are nothing more than editor savable Objects. You can create them at runtime by constructing them like you would an object and populate them with data, however, you wouldn't be able to save them as assets the game can utilize later, so they can only exist as objects in memory. You can save data about them and reconstruct them again later as needed using save games or the like.
is there any difference between starting the dedicated server with 2 clients using the editor or launching from the command line and joining it using command line?
I need help, I have created a problem for myself, I have a system in play that rotates my characters skeletal mesh, and Im taking that rotation value and running it on the server to rotate that actor instance. Works great for clients and the server instance is seen rotating, but if I play as standalone or listen server , Because Im playing as the server and its ran on the server It spins my character in an endless loop.. First node is the logic that sets the initial values , second is me sending those to the server where the rotate actor is running
hello ! 🙂 I just did an implementation of dash in multiplayer, and while it works, I want to make sure that my way of doing it is correct and while possibly not optimal, could be somewhat be considered functional ! any comments appreciated 😄
not sure, but I think it may be because the condition 'is locally controlled' never change value on the server side
Seems like a few too many RPCs. One RPC for the lot seems like it would be enough.
Input > RPC To Server > Server Calculates Dash Speed > Launches character
That makes sense ! Would it be better if I ran the dash directly with « owning client » rpc ?
Not sure what you think better means here or why you would need a client RPC.
quick question how do you specify players? and how do you target all players in the server
To not overload the server, so every clients can take care of running the launch character command on their own
You would want to loop through an array of players and run that command with each player instances
is that the simpliest way?
I just did this and it helped, Turns out I dont have to run on server when Im the server , everything works fine apart from the character not rotating to clients
You can't call console commands over the network. The Specific Player input there is meant for when you may be doing local co-op and the command itself requires a reference to a specific player controller. "Server Travel" is something that pulls along all clients anyway.
ah I see so in my case console command isnt the right choice
It can be in order to server travel, you don't need to call server travel on clients.
so Open Level would be more appropriate?
Movement is usually something the server is meant to take care of.
And "owning client" literally means the client that owns the actor the RPC is on. If you wanted other clients to execute it, then you'd have to use a multicast.
No. If you want your clients to move along with the server to a new level, Server Travel is the thing to use while running on the server and clients will follow along with the server.
oh ok ok, it worked thx for the insight
so if I were to do something like servertravel over the network how would I do it?
(does this only work on local coop?)
or is it even necessary?
You only need to call servertravel on the server.
The server will automatically have all connected clients move to the map the server is moving to, and keep them connected.
Hello there, Im trying to make STEAM working with my project.
I copy-pasted the DefaultEngine.ini from the Unreal website but i get these errors in my log.
[2024.04.17-21.33.51:118][409]LogSockets: Warning: Unable to load SocketSubsystem module STEAM
[2024.04.17-21.33.51:118][409]LogNet: ReplicationDriverClass is null! Not using ReplicationDriver.
[2024.04.17-21.33.51:118][409]LogNetCore: DDoS detection status: detection enabled: 0 analytics enabled: 0
[2024.04.17-21.33.51:118][409]LogSockets: Warning: SteamSockets: Cannot get information on an invalid socket handle, returning null
[2024.04.17-21.33.51:119][409]LogNet: Warning: Could not create socket for bind address 76561199131222577, got error SteamSockets: setsockopt SO_BROADCAST failed (0)
[2024.04.17-21.33.51:120][409]LogSockets: Warning: SteamSockets: Cannot get information on an invalid socket handle, returning null
[2024.04.17-21.33.51:120][409]LogNet: Warning: Could not create socket for bind address ::, got error SteamSockets: setsockopt SO_BROADCAST failed (0)
[2024.04.17-21.33.51:121][410]LogNet: Warning: Encountered an error while creating sockets for the bind addresses.
[2024.04.17-21.33.51:122][410]LogNet: Error: InitBindSockets failed:
[2024.04.17-21.33.51:122][410]LogNet: Warning: Failed to init net driver ListenURL: /Game/Maps/SessionMap?Name=Player?listen:
[2024.04.17-21.33.51:122][410]LogNet: Error: UEngine::BroadcastNetworkFailure: FailureType = NetDriverListenFailure, ErrorString = , Driver = GameNetDriver IpNetDriver_0
[2024.04.17-21.33.51:122][410]LogNet: Warning: Network Failure: GameNetDriver[NetDriverListenFailure]:
[2024.04.17-21.33.51:123][410]LogNet: NetworkFailure: NetDriverListenFailure, Error: ''
[2024.04.17-21.33.51:123][410]LogWorld: Failed to listen:
it does connect with steam, i see the overlay
but i cant create any sessions
Hi, I always struggle with this, how best to invoke an RPC. I know that for Begin Play it is best not to call RPC at all and it is better to use e.g. In the case of character On Possess or in game mode OnPostLogin. I would like to know the order, where and when to call what without using dirty solutions such as using the "Delay" node, can anyone help?
Hey does anybody know of a way to resolve my issue :)
I've seen some cases (e.g: Lyra dash ability) where gameplay abilities use animation montages with "Force root lock" enabled and the "Apply Root Motion Constant Force" ability task, rather than using root motion animation montages.
Is there a specific reason for this method? I thought root motion animations were pretty reliable in multiplayer?
Maybe it's just so dash ability can use adjustable movement distances rather than using the movement baked into the animation?
Does anyone have any up to date references on how to implement predictively spawned projectiles? I found this one in the Unreal Tournament source code but it's pretty old: https://github.com/EpicGames/UnrealTournament/blob/clean-master/UnrealTournament/Source/UnrealTournament/Private/UTProjectile.cpp. Any more recent code references / tutorials on this topic would appreciated!
Hi, how can I make it so seamless travel does not show the transition map at all? I really want seamless travel to be seamless
I just want the players to pop into the new map as soon as the level is loaded without showing a black screen in between
You invoke an RPC precisely when you need to. When you need to communicate something to the server (ie. having a client tell the server it is wanting to do something or feed the server data), when you need to communicate something to the owning client (ie. having the server tell the client to do something or feed the client some data that isn't replicated already through properties), or multicasting when you need all clients to do something. One key aspect of multicasting is realizing that it's not something that happens on a client if they do not have that actor relevant at the time of the multicast - so if you multicast something setting some values on clients and a player joins later, that player who joined later wouldn't have that value.
Depending on what you are hoping to accomplish, no RPC may be required at all. You can utilize "RepNotify" variables that then give you functions that will execute when clients receive a new value, allowing you to drive additional logic when variable changes are received. There is no cut-and-dry answer to when you should do certain things, as it's all very dependent on what you're trying to do and what kind of state things are in and what data you need to perform the right action.
Can you show some code?
Hi, how can I setup a multiplayer game in a way that you can connect to other player using directly their IP?
With blueprints you can execute console command "open <ipaddress>:<port>" assuming they know these values and the host has ensured the port is correctly forwarded.
Ok, I'll try it, thank you
anyone possibly knows why this always returns 1? im using the steam subsystem
Info.CurrentPlayers = Result.Session.SessionSettings.NumPublicConnections - Result.Session.NumOpenPublicConnections;
i cant seem to get a number of the current players in the session
Hi, I'm pretty much a total n00b, and am trying to learn, and am reading some documentation, and i have a basic question. Can someone sum up what replication is in 1 sentence? What is the difference between a non-replicated component and a replicated component? Is something "replicated" on the server? And non-replicated components are only created on the client?
Those info are pinned in this channel. Read exi compendium and wizard cell multiplayer tips and trick
Is there a reason why the pins are different on mobile? I can't see the compendium pin on here.
I'm on mobile and can see them just fine
Click on the search button on the top right corner, then select the pin category
Replication is the process of sending data from the server to clients.
A replicated component is a component that can have replicated properties and can then also be used to send remote procedure calls (RPCs), however, this replicated component must be attached to a replicated actor for this to work.
Replication only occurs on the server, meaning you can have replicated properties and change their values on clients, but unless the value is changed on the server, other clients will not receive the value.
Non-replicated components mean that they will not send their data over the network to clients, however, not all data contained within a replicated component will be sent to clients - you must mark properties within the component as replicated as well.
ah okay, cool, thank you,
The general recommendation is to read the compendium 6 times, then another 6 if you still don't get it. The concept takes a while to soak in
You're right
Mobile pin order is by alphabet or something.
Actually I think it's by message date
While desktop is by pin date
well, i dont really have to use data assets, its just what most of my systems are written around. what i am doing is basically taking static mesh assets letting the user group them up in various ways to create "prefabs" out of them. Im then letting the user inject that prefab into the list of buildables. the data asset only contains information related to the primitive static meshes, so to inject the new prefab, i figured id have to make a new data asset right when the user made said prefab and then save the proper values into it programatically. I guess a structure is better suited for this, i was hoping to avoid rewriting large parts of the system but oh well
yeah im guessing thats a hassle i dont want to deal with. its just what i had already in place before this particular problem cropped up and i was trying to avoid rewrites
It's this simple
Hi everyone, currently I am working in Lyra starter game and I want to make a zombie based on Lyra Character but the problem is:
- I cannot see where the character play their animation
- secondly I cannot see the logic AI Perception Damage Sense, I intended to make zombie react and move toward to player whenever they being damaged
- lastly if anyone know about how to spawn zombie but player cannot see they spawn immediately I would very grateful
U are only hiding or unhide in the server machine
Server rpc = running the code in the server machine
Would I have to multicast in this case?
Nope, that would be the wrong move too
Anything that needs to be sync should be stateful
In this case you can create a bool variable that is set as repnotify
When u need to set the value, do a server rpc.
In the repnotify function you can hide or unhide the mesh
Ah I think I get it now, cheers!
Multicast is a trap for multiplayer Explorer. You mostly want to use it for a fire and forget scenario like playing a foot step sound, or special effects.
Anything that needs to be in sync, you don't use multicast because it is not reliable and can be dropped and in some cases just don't run on some machine (players that is outside relevancy or have yet join the game)
Works perfectly, cheers :)
How does level streaming work in regards to replication? Do I only need to load a streaming level on the server or should I do it on each client?
And if only 1 client needs to load a streaming level, does it also become visible on the server?
is this an official source to download Session Plugins?
https://vreue4.com/advanced-sessions-binaries
Ye
thanks
Yeah this sounds more like a data organization issue rather than a "make a data asset at runtime" issue, which won't solve the core problem. Like what I see is that you need to have the user have it's own runtime values that append onto the static(data asset) data's values and that gets resolved at runtime on what to favor. Makes it much easier to deal with and deterministic for online multiplayer too
yeah thats what i am doing right now
its a pain to fill in all the details again but oh well
I suppose you could use Network Profiler.
You can look at specific RPCs and replicated properties.
I have a very simple multiplayer listen server but was wondering if I should look into a server list/ browser list anyway.
Is there an easy way to see all of the spacewar servers online easily on steam?
Is anyone patient enough to walk me through my project? I've been watching a lot of videos and reading about replication but I can't seem to apply it to my simple project.
It might be best to start with a particular concept or problem you're struggling with rather than an entire walkthrough of a project
The project is just a particular concept. It's only about how to set up RPC's and replication.
I understand the concepts of replication, but I can seem to put it into practice in any way.
setting up? there's isn't usually too much to that other than UPROPERTY/UFUNCTION/GetLifetimeReplicatedProps (and the BP equivs)
All I have for this project is 2 players select an array, that array is loaded into their game instance, both join a session, and then a button widget will print the array you select and a different button widget will print the array they selected.
And I cant figure out how to print the array the other player selected.
Both players can print the array they selected but that's as far as I can figure out.
Im using EOS and i want to host a session but i always get this error:
LogScript: Warning: Script Msg: CreateSession - Cannot map local player to unique net ID
Im unable to host the session
Does anybody know why?
the "array" is delightfully vague, but you can send an RPC to the server if it's something generated by the client in the first place
It is vague. It's just an array of integers. It's the simplest thing I could think of. How would I send an RPC to the server? I'll send some pics of what I have so far.
I understand the pieces of it, but I can't seem to grasp the whole.
on an actor the client owns (player controller, pawn) you can have a call on server event
So in the player controller, create a custom event that has its replicate setting to run on server?
Correct
And then I call that event from the button that would print their array?
can someone explain or link game mode option strings? I cant seem to find much information on them. I know its thing=value and ? As token seperators but i dont know what the tokens are or what’s available
You basically make up the tokens yourself.
So for example if you did something like....
?test=5?maxplayers=20
You can access them and use them as you need:
yeah but there are ones that already exist like listen and loby and others
im interested in the existing ones
usual method, i set it on server
i would assume it should get replicated eventually but it stays false when it should be true
maybe i should set it on tick (on server) ?
setting it once when the race starts should be enough
yea
i dont get it
i have this gamestate as a child of another blueprint gamestate, should i transfer the bool to parent class? (i assume thats unnacesarry)
Was wondering if server/browser lists were important to any online game, and if so the reasons why.
It can be if you intend to allow players to easily find games they want to join, but it's not necessarily required. You can do some kind of matchmaking system in a backend service, and then have that system choose one player to be the host for example. Players wanting to join later could still be "searching" for a host, but without having to select one specifically.
Server lists are good for a few reasons:
- You can let players find populated or under-populated servers.
- You can let players choose servers that have better ping to them.
- You can let players choose what level they want to play on, or look for custom settings that your game may have that they want to play with.
- If you're allowing players to host their own dedicated servers then you're allowing communities to form around specific servers as they can rejoin the same server again in the future.
Wow thank you very much, that helps a lot.
Use repnotify
How do i replicate camera pitch?
For a card game, I can easily get the cards in the owners hand. but i cant figure out how both clints could display the opponents hand. There is a piece of replication knowledge that i'm missing.
"Cards in hand" exists on the player controller.
and I know how to create a custom event, and set its replicate to run on server and stuff.
Player controllers only exist on the server and the owning clients, so it's not necessarily a great place to store the hands that players have as other players will never be able to see it.
For now forget about "cheating" aspects but the PlayerState would likely be a better place to store their current hand as this is replicated to everyone and is a direct association to the specific player.
So this means you'd want your arrays stored on the PlayerState, and marked as replicated. If a player wants to know about a specific player's hand, they would just need their PlayerState and read the replicated value.
I'll give that a try. Thanks for helping me out
So to get a specific player's PlayerState, I would need to keep track of the players that connect to the session (probably in an array). And then check if the player in the array slot == their player, if its not, get that player state.
Does that sound right?
The GameState contains a "Player Array" which is the playerstates present in the game.
To know whether a playerstate is yours in an online multiplayer environment, you can get the player controller of the PlayerState, and if it is valid, you can check if its locally controlled, and if so, then that would be your playerstate.
This helped a lot! Hopefully this gets me out of my sticking point. I can't thank you enough.
Voice chat is not working after server travel...
I am using the Eos plugin
How can voice chat work after server travel too
Are there already some code examples of Iris rep system? Or any docs other than the introduction to Iris? https://dev.epicgames.com/documentation/en-us/unreal-engine/introduction-to-iris-in-unreal-engine#overview
There's very little documentation on it from what I've seen, but it'll be mostly compatible with how things currently are anyway
can you elaborate why? does it replicate in a different way apart from notifying about replication?
i suggest reading the source code and see how epic utilize iris currently in souce.. like sswires said, not lots documentation is out right now and the official one is kinda shit to be honest 😦
True, that is what I am doing. I did the same for rep graph, which Iris seems like a natural next step of. I was just hoping there would be a small example I can put a breakpoint to and step step through the code.
Using repnotify the value will be updated when a player joins in late. Just using a multicast it just performs the action on all clients at the moment basically
he is using replicated variable
even late joiners should get server's value
and ofc multicast has no place in this context
I didn't really see the context
repnotify functions dont get called before beginplay ever right?
repnotify functions absolutely get called before beginplay
you can check HasBegunPlay though
oh dang for some reason i assumed they wouldnt fire before beginplay.. time to fortify some logic
What would be an alternative to using OnlineSubsystemSteam, integrating steamworks sdk?
One of the things I've learnt hanging out in this channel from the experts - never assume anything about timing of replication for anything. always assume something can fire before/after something else regards of how you code it - i.e. due to packet loss and weird engine things.
I can it the Schrodinger replication theory; something can replicate before or after what you expect; and you wont know until a crash report comes in.
alright, thanks. do i need to update that bool variable on server when a new player joins the server?
oh ok
What to update? The player that joins will simply get the value from the server on the next net update
Is Iris replication enabled by default in Lyra? I've put a bunch of breakpoints around some initial functions but none of them are triggered.
UReplicationSystem::Init doesn't get called either
I also tried disabling "ForceStandaloneNetMode" in World Settings bud had no difference
I would be glad for any information on how to launch and debug Iris
I downloaded the project from Epic Marketplace and am using binary build 5.3
Does someone has a fucking idea of what error that is : Not enough login credentials to launch all PIE instances, change editor settings
im trying to figure out why that bool is not updated when the player joins server after the race is started
on server = true
on client = false
Is the recommended place for notifying a character is possessed and do setup related to that OnRep_PlayerState? Regardless of dedicated server, listen server and client?
Isn't that (ACharacter::PossessedBy) server only?
there's even a nice little delegate for you that's called on both
ControllerChanged on the pawn if I recall
though here's the kicker, the client won't know about anything other than their own possession changing since controllers aren't replicated
the player controller has a delegate for when the controlled pawn changes
necroing this... but came across this today and forgot about it
if ur using deferred spawn you gotta manually invoke FinishSpawningActor
otherwise BeginPlay() will not be invoked on server for that actor
Hey people, any one did host a unreal server in AWS with linux please please tell me ?
Does anyone know if sandboxie needs any special setup for running UE games connecting to steam? I am running a packaged build and have added my steam_appid text file in the right place. It looks like it connects briefly, but then crashes with a Fatal Error! message.
this applies to a lot of people, and I'm not sure what would be AWS-specific, but it's best to ask rather than asking to ask
Well swires
Easy thing I need to get an Unreal server dedicated or listen
problem is I am not sure what hosting platform to take
1 -Home basement
2 -Amazon
3 - Some other platform .....
What do you recommend
?
Well it depends on a lot of factors, and you mentioned listen which doesn't need any dedicated server infrastructure at all and costs $0
But you only could get away with listen for something that isn't competitive
Host advantage and all that
Like a PvP game
The host of the listen server would have an advantage because they're not dealing with latency
Dedicated better lag?
A big con is that game quality is very much tied to the quality of the connection of the hosting player
So I wouldn't use it for hosting more than a handful of players
At least with cloud and GSPs there's somewhat predictable server performance
Ready to sign up for an AWS Free Tier account to get started using Amazon GameLift? In this 5 minute video, we’ll walk you through the AWS signup process and show you how to get started using Amazon GameLift!
what do you think about this? is it worth it ?
@crude kelp
I only have experience with hosting at home, and using an Azure VM with a Windows dedicated server.
Linux or Windows, there isn't a huge difference. If your packaged server works on your home network, it will work on a VM.
For dedicated you'll have to port forward, which is easy to do on your own router, or the virtual net in your cloud provider.
As for pricing, I think AWS, Azure, and Google Cloud are fairly similar, all quite expensive for someone like me. You'll have to look into the specific cloud service to know exactly what the price comes to, which you can do with trail versions or price calculators.
Another advantage of cloud providers is that you can deploy servers in specific regions without having to rely on your community to host servers, but you need a budget.
Gamelift is ridiculously expensive from what I recall
There are game server orchestration platforms that use bare metal servers which give much more value for money, but that requires shopping around
Well it's fine for internal testing
becasue AWS is some how what I did not expet
expect
there are plugins involved
I don't like that tbh
I don't think you have to use that if you have your own backend
Since iirc it just wraps REST API calls
Indeed. Like I said, if it works at home, it will work on a VM.
By that I mean works over a wi-fi.
mmmmh true
Though a LAN environment won't give you true reflection of how latency resilient your game is
emulate lag aint bad... i know
Thing is, no one can really recommend anything. Hasn't given any details about the project and the things they expect. May as well pick something at random and say go with it.
I want to create server hosting unreal game should not be complicated
You connect the IP and
yeah....
Really you need to get your server performing as efficiently as possible so you can push for higher server density (ie. Game server processes per physical server)
Well that's all you do in the end
Just to get started, I think it's fine to just make it work at home first, and you can start to profile and scale for more specific requirements as you have a better sense of what your game and servers need.
If you don't have the experience, it's best to just start somewhere IMO, unless you're going to outsource that work.
hahah thanks a lot for answering again!! 🙂 We were indeed using the FinishSpawningActor. After some debugging, found out that other issue was the problem, related to our own code. After fixing it the problem dissapeared
well thanks guys I so far got that I have to really start from home as someone said AWS is expensive the game lift and overall dedicated seems to be much more effiecient
And i don't have exprience with dedicated so I better start already later on I will port the one from home
hello everyone,
I have a basic session connection over steam question
I added basic create and find sessions using unreal's online subsystem, and then add steamwork sdk intended for internal testing.
it works well in the IDE settings. but it does not work for packaged version (development)
when clicking on the create session button the packaged game does nothing.
does it has anything to do with the firewall or engine default settings?
I have API keys that only the dedicated server needs. Is there a way to prevent a string table that contains the keys from being included in the client build? Or am I thinking about this the wrong way altogether
One way I can think to do it is that you can store the keys in a file and have the game instance read the file on init. Never distribute the file.
Also makes it easy to update keys externally without having to repackage.
Got it, alright
Is gameinstance guaranteed to exist before game state? My intuition says yes but maybe wrong
Hey, just doing to dedicated server and packaging workflow testing and I just want to confirm some stuff,
Whenever I make code changes, I obviously need to recompile both server and client configs if I want to test again and launch the .exe files from the binary folder, and then after rebuilding I need to cook content again (but what about if I made changes only on code?)
When it comes to packaging do I just do it from the editor but instead of cook, I run the package option and it will give me seperate entire packaged builds with their own folders and everything, correct?
All level is owned by server. Anything you place the actors will replicate to client Level streaming works with player camera. And camera is owned by client. Level streaming works flawless in replication.
Did you by any chance find out anything? I feel like anything i have in mind is either over complicated or over simplified
I have a shipping build with steam integration (adding in a steam_appid.txt file to make it work) and am trying to run it through sandboxie. It is crashing with a fatal error, where it did not when I was running it without the steam_appid file. Are there any tricks I should be doing to make sure my virtual env is effectively the same between that an native?
If I am making a game that has both dedicated matching but also the option for co-op listen server (as In I want people to be able to play together just by having the "host" be a player aka listen server), am I suppose to just be packaging for server and game since client strips server only code or would I still do client and server packaging only and the only things I would guard with #if WITH_SERVER would be backend server stuff?
Can a client be a listen server and what do they miss out on compared to just a game target package build is what I am asking I guess.
Still got no response
Does Iris even work atm? I thought it was still in prototyping?
It’s marked as experimental but it should work, but doesn’t for me
Probably more than 95% of things will not change when writing your game for Listenserver or Dedicated Server. Most of the code needs to function the same regardless. Most things are already gated like spawning of particles or playing sounds, etc. If you're making a game where the player can join a dedicated server, or can host a coop game, then you package two separate things. Normal game package, and dedicate server. The dedicated server cook is the only special one as it cooks to be ran without a renderer and whatnot.
Yeah that's what I was thinking, I just wasn't sure where client fits into that, I guess its for if there is no concept of a listen server in the game, is that right?
I still can't figure this out 😦
Fatal error: [File:D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp] [Line: 3240] Object B None created in BP_ThirdPersonCharacter_C instead of A```
Both objects A and B are replicated UObjects, **B** is created with **A** as an outer
Is there something I can set to tell replication system don't create B instead of A or am I not supposed to replicate UObjects within other replicated UObjects?
To be clear, Client and Listenserver are the same build. There is no difference. You don't make a special build that has no server code for example. Even if there is no concept of a listenserver, your client still needs most of your networking code there to work correctly. The one exception to that might be cooking out secretive code you would never release to public for whatever reason to avoid it being decompiled and examined. But that level of handling is fairly rare and usually unnecessary.
This isn't anything related to replication. You've outered a class to something it isn't allowed to be outered to.
if ( (InFlags & (RF_ClassDefaultObject|RF_ArchetypeObject)) == 0 )
{
if ( InOuter != NULL && !InOuter->IsA(InClass->ClassWithin) )
{
UE_LOG(LogUObjectGlobals, Fatal, TEXT("%s"), *FString::Printf( TEXT("Object %s %s created in %s instead of %s"), *InClass->GetName(), *InName.ToString(), *InOuter->GetClass()->GetName(), *InClass->ClassWithin->GetName()) );
return true;
}
}```
If the Outer you're trying to create the thing with is not the same class as the ClassWithin property on the class you're trying to create, it will throw this error.
The debugging shows the following
InClass is B and its ClassWithin is A, but InOuter is BP_ThirdPersonCharacter which is incorrect
B is supposed to be within A and is created accordingly on server, it works as expected, the issue happens on client
I'm not sure how I'm outering a class to something it isn't allowed to be outered to, It only happens on client side which I have no control over atm since replication system is responsible for that part afaik, Please correct me if I got it wrong!
Sounds like you might have replicated B through the character instead of A on accident. To clarify a few things, what native object types are A and B?
Is this the right channel to ask about whether it's possible/how to NetSerialize TMaps?
TMaps aren't meant to replicate or be sent with an RPC. If you need one for the lookup speed, generally favor a helper struct that sends the data through an array or FastArray, and reconstruct the map on the other side.
So like, I'd be converting it into a TArray of TPairs, or perhaps just two different TArrays?
I felt it made more sense to ask it here, but the issue originates from GAS where its Set By Callers on Active Gameplay Effects don't seem to be replicated, so I can't access them for UI purposes on clients.
You can make a single array of a single struct type that just has a value of the map's data type and the map's key type.
I see yeah. I'm not quite sure from the GAS perspective if it's the right call, but I don't see another way around it.
By native I assume you mean unreal classes?, If yes they're UObject
To give more details, Here's the setup
BP_ThirdPersonCharacter -> MyActorComponent-> A -> B, Left being the outer of right
MyActorComponent creates A which then creates B all on server side and they're set to replicate, A And B are replicated using MyActorComponent::AddReplicatedSubObject
If B is set to that actor component too, this will probably be your issue. A needs to replicate B instead of the actor component.
EG A needs to call AddReplicatedSubobject for B instead of the actor component and have itself set up to replicate subobjects that way etc.
I'm trying to use Simple Move to Location, but it only works on the server player, I saw somewhere that it only works on server, so I created a custom event to run on server, but it still doesn't work on clients
It seems to be running on the correct player controller too
SimpleMoveToLocation will work if called on a client as long as the client possesses the pawn, if I recall correctly.
It's not AI based, so it doesn't have to be server authoritive. It's similar to a player pressing keys to get to the same spot.
Yeah, I have created a new top down project just to test it
But it actually seems a little broken on the client
Ok, it seems like the Simple Move to Location really doesn't work on client, because this behavior was due to the other way to move which is by holding the left mouse button
I removed it and left only the Simple Move to Location, and it only works on server
That's what I'm doing honestly, If I understand correctly of course
A creates B, B then calls MyActorComponent::AddReplicatedSubobject for itself
MyActorComponent manages A and A Manages B if that makes sense
I believe making A an ActorComponent instead of UObject would solve this issue but I'd love to keep it as is if possible
Not quite 😄 You said this was your hierarchy.
BP_ThirdPersonCharacter -> MyActorComponent-> A -> B
Character houses ActorComponent and replicates it.
ActorComponent houses A and replicates it.
A houses B but right now you're replicating it through the ActorComponent that also owns A.
What you need is
Character houses ActorComponent and replicates it.
ActorComponent houses A and replicates it.
A houses B and replicates it.
B needs to get A and call AddReplicatedSubobjects, not the actor component.
Wait, UObject also has AddReplicatedSubobjects? 😮
Hmm. Maybe it doesn't.
Fairly certain this is happening as in multiplayer client side navigation is disabled by default and that node is directly requesting to use the navigation system. It may work if you enable it here in the project settings:
That worked!! Really thank you!
Just out of curiosity, do you know why it's disabled by default?
Likely because most systems don't require the client to use navigation. AI is almost always server side, and that's generally where you'd be using navigation.
Got it, so could I do the Simple move to Location through the server? Or in this case it would be better to just enable this option?
Hmm. I'm not seeing an easy way around that. :/ Have never had to consider doing multiple uobjects like that. Initially seems like it would take quite a bit to work around that unless you can just remove that use within flag. Without that it might work as you're wanting and not throw the error.
Never thought of removing within flag, Will definitely take that into consideration, Thank you!
Unfortunately, I'm not sure what the impact would be other than your client is calculating its own navigation. It may allow the client to move in ways that the server may not necessarily want them to move, like a client could spoof their movement but I'm not certain of this either.
"server travel" works smoothly in the game engine, but when I render the game and try it on real computers, "server travel" does not work.
What is the reason
Ok, thank you again for your help
I would just be careful with any GetOuter calls you use if that works. 😄 Client might be getting the actor component instead of A, I assume.
Got a question for you guys, is there anyway to stop a server from updating physics to simulated proxies? specifically in blueprint? I'm trying to have client simulated physics on a replicated character, but it seems as if its ticking velocity and position from the server leading to slide show physics with errors.
The call
I couldn't get it to work. I'll have to try to learn more about why.
For a 2 player card game. Where would be the best place to store the arrays that hold Deck, CardHand, FieldZone, and DiscardPile.
Some people have said playerController, others game state, but I originally thought Game State.
depends, does the player need to know each other card?
but all info and truth should be read from server
Idk how to store anything on the server yet.
I think for now, it'd be easier if the player could see each other's cards.
I think there is a bit of confusion then
server is always there
listen server*
one of the player has to host the game
so that player will be the server so to speak
dedicated server is just a headless server, it doesn't render
Unreal networking out of the box uses server to client model
If you are a client, w/e data you have for a card game shouldn't matter
it's just there as a visual aspect
all calculation and actual cards that are played/discarded etc are handled on server machine (The Computer of the host)
Ok, all the info should be handled by the server.
Host*
card game or turn based game are pretty easy imo
Deck and Discard pile would probably be game state. The hands of the players should probably be stored on PlayerState.
You would generate the deck on the server, and pull cards from it, and assign it them to the CardHand of the PlayerState that is being dealt the card on the server. The CardHand would be replicated so others can know the hand.
if client needs to do anything -> Request to server -> Server validate and apply the move
I thought it would be easy too but a lot of these concepts seem to be stumping me.
takes a while to soak in, if you haven't read the compedium 6 times, do so
then another 6 if still stuck
but Imo it helps to think of breaking down what should be run on server, what should be run on client. Where data should be hold, etc
Doing turn based game, you are already eliminating one of the harder aspect of multiplayer because u don't need to account for lag
I've read the compendium like 3 times and have watched many YouTube videos. I even bought a simple rock paper scissors project to try and study how it works.
replication is the easiest part
Youtube videos for multiplayer are generally trash with some teaching the wrong thing all together
it's not really a tutorial zone
but if u are already comfortable with OOP and have been using Unreal for a while. With sheer determination you will get it eventually imo
took me like 3 weeks
Thanks for spelling that out. Trying to put things in the right spot has been discouraging me too.
My tip would be, don't use Multicast RPC for anything that needs to be in-sync. So for your card game 99% of the time you wouldn't need multicast
I'm just starting my second week of trying to figure out replication and implementing it.
Thanks, I'll keep it in mind.
I got really far on making the game when it was only a single player but adding that second player has me back in the hello world phase.
i'd say it's a fact. completely changes how the game is handled.
100% but for a game that don't account for lag (eg chess or card game) the difficulty is much much easier
i figured it would be but this is harder than i thought too
i've even down sized my expectations for this card game project.
So would I need 2 deck variables (deckPlayer1, and deckPlayer2)? Or would it just be 1 deck variable that would be replicate so both would have their own version of that variable?
replication means "a copy".
So you would have deckPlayer1 (which is the server), so that doesnt need to be replicated.
Then deckPlayer2, which is for the client, and that one would be replicated to the client from the listen server.
The easiest place is just have a deck stack attached to each playercontroller
if you want each player to see each others cards (reading an old comment where you mentioned that) - then you would just have playerDeck1 and playerDeck2 on the game state, since game state is replicated.
So playerdeck1 and playerdeck2 wouldn't need to be set to be replicated because the whole game state gets replicated?
They need to be replicated as well, because you can have non-replicated variables inside of game state.
So "game state" is replicated, which means things inside of it is replicated, but you can pick what is actually sent or not.
You would only need one variable defined on the player state. Each player gets their own playerstate.
We're also having two conversations now, so your getting conflicting answers because it depends which path you go down.
If players only see their own deck -> Playerstate or PlayerController (to replicate only someone's cards to that specific person)
If players see all cards -> Game state (to replicate everyone's cards to everyone)
(There are other places you could put them, other answers that work as sell - it is just a starting point)
I think I want both players to be able to see each other's hands. Idk how id display how many cards the other player had.
PlayerState replicates to all.
Hey guys, I'm really interested in learning about physics replication in unreal engine. I came across this post detailing the enable physics resimulation option . (https://vorixo.github.io/devtricks/phys-prediction-show/) . I was wondering if anyone had toyed around with this option to get good results ? Right now it is quite jittery. Also I heard this is still in development, maybe it's gonna be fully finished in 5.4 ?
also if anyone has some good ressources to learn about this stuff i would be super happy
I have a question regarding server authoritative shooting.
Long story short I'm saving all bones inside physics asset of the character each frame inside HumanMovementComponent. Then, when player determines a hit, he'll sent the timestamp of the hit to the server, so that the server can rewind the target to the position of the hit based on the saved moves he has from the HumanMovementComponent. Just for the debug purposes, I also get the closest saved move from the whole array to the position in which the player saw the target at the point of the hit.
Issue is, that sometimes, this closest saved move is still decently far away from the position, where the player saw the target. How can this be? Does the autonomous proxy extrapolate all simulated proxies based on the last input? I thought that UE's movement replication is very decently deterministic, meaning the simulated proxy will only be at the position which was already accepted by the server, when the simulated proxy sent his movement data to the server and the server accepted them.
I have a question, currently its not possible to replicate Movement such as Sprinting, Jumping, Flying, Swimming, Vaulting etc. with blueprints PROPERLY from my understanding. So as soon as there is desync or latency from the client to the server everything breaks for the client and even with no latency it leads to stutter and jitter when the client is just sprinting. I looked into plugins such as SmoothSync, GMC V2, GAS Companion. Im looking for a Blueprint only solution and found Reddy-dev's BP CMC Networking Plugin which apparently hooks on C++ code and exposes it in Blueprint. But i also read that Mover 2.0 is coming with 5.4.
So my question is, does Mover 2.0 work the same as CMC with blueprints, and how hard will it be to convert from CMC to Mover 2.0? So do the nodes such as Set/Get Max Walk speed etc. stay the same, and how much work will it be to properly set prediction, and syncing it up? So to simplify my question on a low level. Should i use the CMC Networking BP Plugin NOW or wait until Mover 2.0 gets released and do everything with Unreals Plugin?
Or should i use any other plugins i named which don't need C++ for me to use.
Mover 2.0 is going to be experimental. Don't rely on it. Just use something like GMC plugin if you're trying to only stay in BP land.
fwiw, Setting MaxSpeed form outside will always be a correction
No matter what system you use
CMC and Mover (NPP) only predict Client actions. So if you alter MaxSpeed, you'd need to run that through the Client and that allows cheating. You can only ever communicate that the SprintKey is pressed.
Mover (NPP) will probably not be usable in 5.4 for BP people. There is some stuff exposed to BPs but I doubt that is enough. We are 98% using it in C++ again atm.
If it does get more attention, we can probably start using it more commonly than CMC in 5.6+ or so. idk
Thank you Cedric for the advice, i guess im going to stick to SMN2 then and keep the component
Also with Mover 2.0 if the component changes it means the nodes also change, so the library i can use from the context menu will be completely different and nothing will work
Also the states will be different for sure
This first part is just not true. I keep seeing people say this, but you don't need a plugin to add smooth sprinting with Blueprints only, latency or not.
Goes for other actions too, like root motion or launching the character.
CMC can stutter when there is packet loss, but I believe this happens with C++ too, unless using a customised version or a plugin, but feel free to correct me if I'm wrong.
So fellas, real quick question for ya. I'm working on a multiplayer Tennis game just something real simple. I have a question about ball physics.
If I'm doing a server based 2 player game. Is it smart or feasible to have the ball have physics like a projectile motion formula for instance? Or would that ruin the game on desync?
I'd start with deciding whether or not you want prediction
As in predicting who'll win?
no, predicting the movement of your tennis player before the server says what they did
Do you need things to happen instantly, or to happen the same on all clients and the server, choose one
Are you intending this to be networked or just local multiplayer?
Networked yeah
Yeah that's gonna be hard as hell, especially predicted
Always love me a good challenge 😛
Basically, when you press the button to hit the ball, do you:
A - Want the pawn to swing instantly, and the ball to change direction instantly if hit
or
B - Are ok with the swing command having to make it to the server, which relays info back to the client, resulting in a ping lag between pressing hte button and seeing the swing
?
What would make a more stable experience?
B is more stable, but you got the lag
If you don't know what I'm talking about then you have to do some reading on it
this is the core problem of multiplayer
and anything physics-like with quick interactions between different clients makes it much harder
Nah I get it
Hey I could get the home server with 7777 " port " going
Now I will try to get a remote listen one goin
Anyone else using unrealengine 5.3 realized that RepNotify (blueprints) variables behave pretty strange / broken? They seem not to fire on clients when the server updates a variable nor do they fire on the server if clients update a variable.
I'm updating a string which does not fire the corresponding function on clients when the server (listen server / client) updates it and also on the other side, if the clients update it, the server does not fire it's corresponding rep notify function
Replication is only one way, and if you want any other clients to receive the value of a variable, it must be set on the server. What type of object are you setting the variable on?
Couldn’t he use the new physics resimulation ? Or is it not production ready yet ?
thanks for the reply - I'm setting a string on a pawn / with delay after begin play. Client joins a little later than the server.
Seems to work just fine on 5.3.2
what I'm breaking it down to right now, Is that it seems to work when the variable updates when everybody is already connected - but the variable seems not to be there when clients join when it did fire ones before a client joined. so I would have expected, that the notify is happening "retroactive" so to say and clients get the updates when they connect?
That is the purpose of RepNotifies. My guess would be that you may be setting a value into the string on clients that doesn't exist on clients, so it ends up filling it with nothing. The server would always populate it first as its begin play would fire first, but if you don't gate the begin play so that only the server does it, then clients could end up removing the value as they don't have anything in the variable you're using to populate it.
actually it does exist if i print it before updating the variable. thats the strange part.
So if the value already exists on clients,why would you be replicating it in a separate variable to begin with?
Maybe a missunderstanding - Server is already in the game - client joins late - clients wants informations the server already set up during the game - client does not receive rep notify of server after joining - clients sets informations after begin play - server does not receive rep notify event.
Again, replication is only one way. The value must be set on the server for other clients to receive the value.
If a client has that value, you must RPC that value to the server first, then the server can set it in the OnRep variable, then other clients would receive it, including any late joiners.
Setting a variable on the client will only ever change it on that one client even if that variable is marked to replicate.
and now the fun part: that does not work either
Which part? The RPC or the Replication?
just so I'm sure I'm testing everything right: if the player who is the server sets a variable of it self that others should receive when joining late, a repnotify should be enough? right?
Server is in the game, sets it's user name with rep notify, clients join late, rep notify should fire?
other way:
Clients executes a Run On Server RPC with the value - server executes rep notify with the value -> server and other clients should receive the rep notify event and fire the function?
Sorry... there is a bit of an error in there... Server appears to be firing the Receive Controller changed too... Fixing...
The server one is much earlier in the log, then the client joins and the next names print.
thank you very much - I will rewire some stuff clean and check exactly what I'm missing.
appreciate your help!
How can I make loading screen in listen server ? Did anyone implemented before
Is playfab generally more expensive than game lift?
I couldn't find a specific price calculator like game lift has it but the examples on playfab were more expensive than they would have been on gamelift
Playfab just has other features besides dedicated servers
The same way you make one in a client.
I just sync load it all, who needs loading screens
Pcie 5.0 x4 solves that 😄
/jokes
If i use a Client Authorative approach to sync movement with the Server which kind of movement should i check with the Server? I honestly don't want to change the Movement Component or replace it because i just can't wrap my Hands around C++ and it would be way too much work. My Plan is to use SmoothSync but somehow jank important mechanics into C++ to make it Server Authoriative. So my plan is a First Person Game which is basically just COOP but no PVP, all i want to prevent is the Clients from Speedhacking and even more important to have smooth movement and animations even with higher latency. Would you advise to just lock basic movement such as walking/sprinting behind a C++ Replicated system or is there more to it? I really don't want to rewrite all the code because my game won't have any special abilitys.
I work on projects that do not agree with this. 😄
Or is GAS Companion better suited for this?
GAS Companion doesn't really have anything to do with movement. GAS Companion exposes parts of GAS that usually require C++ set up to blueprints, however, not everything from GAS can be exposed to blueprints and you will likely discover something is far more easier to do if you were able to do some C++ in the first place, so you will likely still need some C++ if you want to do anything more advanced, especially for multiplayer.
If you're attempting to make a multiplayer game, you are almost guaranteed to need to do something in C++ at some point as well as the engine also doesn't expose everything you could potentially want to do in multiplayer systems to blueprints - one example is handling net relevancy of actors, which isn't something you can change at all in blueprints or the editor save for maybe the net relevancy range. In some cases you may not necessarily want a specific actor replicated to everyone all the time even if they are within range, so this is one example where it could help with network performance or help prevent some forms of cheating.
This all said, the Character Movement Component already has client prediction of movement built into it along with server correction. The only thing is prior to the new "Mover" system (in 5.4?), you had to modify the CMC and add different types of moves in C++, but they've exposed some of that to make it easier to make things within the editor rather than in C++. I'm not really familiar with it myself, but from the little glances I've seen of it, and with my own experience in editing the CMC, it looks like it simplifies things greatly.
I actually watched some hour long videos about Mover 2.0 and it seems even in the latest version the absolute most important stuff is still hidden behind C++, reference : https://youtu.be/AzO80wLeAPY?t=634 , i mean that has absolutely nothing to do with the CMC we are used to. The three biggest gripes i want to circumvent are : Players being able to Speedhack, Animations or Player Position being out of sync with the server (example the player walks into a wall and suddenly he has a different position for the server and everyone else). And jaggedness/rubberbanding because the server tries to constantly fix the position of the player. Im sensible to too much delay for movement, i want really smooth movement even if it would cost the possibility to cheat, im not making a game to make money, but rather trying to get my idea in my head into reality.
#unrealengine #ue5 #unrealengine5
Social Media & MORE:
Fiverr: https://www.fiverr.com/qinq96
Discord: https://discord.gg/qc7C9GS5
Twitter: https://twitter.com/polysiens
Reddit: https://www.reddit.com/user/Polysiens
LinkedIn: https://www.linkedin.com/in/petar-ples-08a04356/
Personal Website: https://venturoustudios.com/
UE Marketplace: https:...
Why are you even considering mover 2.0
It is experimental, unfinished, and if what you need is humanoid character movement CMC still works fine.
If you aren't working in C++ it shouldn't even remotely be a consideration as you aren't going to be able to debug anything that goes wrong with it (or even use most of its functionality, seeing as the benefits of even using mover are locked behind C++ right now).
And even if you are, if you don't understand why you'd want mover or have the experience to dive into it without documentation it shouldn't even be on the list of things to use.
The basis of this question doesn't make much sense anyway - CMC is already "smooth".
Yes thats why i talked about mover 2.0, because like i said i guess its still to C++ heavy and not usable with BP in the near future
Right, they haven't even said why CMC isn't under consideration here.
Heres a list that lowkey shows what im trying to accomplish :
CMC already does 90% of that out of the box.
And the last 10% would only require the use of root motion
animation concerns are separate anyway, the only custom stuff there is sprint and vault