#multiplayer
1 messages ยท Page 57 of 1
weird i had cast to game mode in client and it called function succesfully but now when I closed editor and started it it got stuck at 75% loading -_- and i figured out its because of playerpawn where was this cast
so it messed up something
I can cast to game mode from player state?
i need somehow call game mode function from client
In PlayerController or Pawn or maybe Playerstate:
Entry -> Run on Server Event -> (now you're in the server's version of the object) Get Game Mode -> Cast to YourGameMode -> Do the thing
You need a run on server event between the clientside stuff and the serverside stuff
run on server event is the ONLY way to tell the server anything
just show your code
cant load
unfortunately i cant show u code as my game with current code cant run... I need revert changes and make it again
well 2 hours of work are in bin
First of all GameMode shouldn't be storing PlayerWithBomb
it isnt
According to that code it is
I have ?bomb bool in player state and game mode just go through all controllers and check if they have bool is true
if it is its found it
Just have PlayerWithBomb be a reference in GameState (if other ppl are meant to know it)
i remade it already
no need to loop or whatever
but still dont understand why if I have bad cast or code editor wont run .... fk why it just cant throw error when trying to play
but no it wont run editor at all..
ah
i need now remake it
What are the general rules for your game? A player can have a bomb. What else are the mechanics?
this is video what it did dont look at movement its broken now
and I stopped it at the end to see
i take bomb and then after countdown it will take damage to the base which is nearest
to the player who has bomb
but i cant anymore run that game as its at 75% vcs of bad cast
๐ฆ i am going to do it from scratch
I have a RPC marked as Client that is only invoked from the server, and inside this client RPC I draw some debug text and set some HUD text. I only see the HUD text on the client that I expect to, but the debug text is drawn on all clients. it's a 2 line function, the first line draws the debug text, the second line sets the HUD text. this makes absolutely no sense to me? surely it should only be drawing the debug text on the client that its updating the HUD text on?? can anyone explain this magic
I'd do it like this.
In bomb actor:
Event Overlap -> if has authority and other actor = Airplane or whatever -> Attach to OtherActor -> Disable Collision -> Timer/Delay -> Destroy closest base
No need for gamemode or gamestate or anything like that.
It's that simple
DestroyClosestBase can inform the gamestate or gamemode if you want for scorekeeping etc
i dont want destroy just take like 200 damage
You mean actual debug screen stuff? Might be a Single Process editor stuff?
well you get the picture. Let the bomb do the bomb stuff, no need to involve Gamemode or Gamestate etc.
GEngine->AddOnScreenDebugMessage - like this?
my bomb now
i am using also game mode to countdown
Yeah just check if the same happens with proper standalone setup
That can work but I'd do all the bomb mechanics inside the bomb
like this
Pretty sure onscreen debug is showing on everyone due to the single process
going to try
Ahh, will try
but i cant because after I pick bomb its get destroyed I call destroy actor and then I cant do any more code inside because its already destroyed
thats why I did stuff after countdown is 0 in game mode
just don't destroy it
let the bomb do the countdown
I mean it's a matter of taste but that's how I'd do it
its picked
oh boy, lots of things break if it's not a single process. this is not good ^^
what if i tried make logic in player
who took bomb?
hm
can work?
Why? Would you put gun logic inside a character or in a gun actor?
Why not put all the logic for everything including the airplane flight inside the gamemode
lol
because BOMB will be destroyed after picking
i dont want to see it on map anymore
its like collectible
Just don't do that. Turn off collision, set it hidden, attach it to the plane that picked it up.
hidden means i wont see it ?
sorry for dumb question how to attach XD
I'd do the item logic inside the item, then it'd be trivial to make a new item like one that you can pick up that'll heal the closest base. You'd just change a few values and voila, it'd just work.
all up to you tho
ok i will try but another question i do have this timer which is running when it is 0 i should call event from bomb but can I cast to it from widget?
Widget should just SHOW the timer, not define it
timer lives on bomb as a replicated variable I'd say
nope i am calling countdown function to game mode from bomb after picking and then in game mode calling it on all clients and then widget has timer itself
also this was problem for me how should bomb make count down i can multicast widget of count down to others?
i thought its not good solution so i used game mode to it
argh, I've been using things like GetLocalRole() == ROLE_Authority and only running client side actions if that is not true. I've been testing as Play As Client. guess whos listenserver does not work at all
okay i did it like you said but i dont know how to multicast widget from one player to all or if its right so I made similar timer in bomb and set same time and both are ending together
can I remove mesh instances from server or are they literally not even known about by the server?
The widget shouldn't have anything to do with the networking
UI should be local only
bro but count down need to see everyone on map
if i pick bomb
then all should have 10sec countdown
on monitor
i need multicast it
Bomb is a replicated actor. Bomb state has an onrep which tells every local HUD or Playercontroller to show the UI
That can work
and its only multicast as its called from remote
so its authority server
its working but I tried on another pc my project and its again 75% loading
so something is wrong there...
some cast
Your code is jumping all over the place. The bomb can just multicast within itself or use an onrep
Picked up -> multicast or onrep -> get local playercontroller -> cast to yourplayercontroller -> show countdown
thats what i am doing
This already executes on all. Just get local playercontroller. No need to loop or do any other network stuff
last thing I need is when I kill player who "has" bomb and kill him bomb will drop on his position and prepared for picking
i will try
are you sure ?
Get what you have working first before trying to add more on to it
I mean it's a multicast event so yeah it'll execute everywhere. That's assuming you've replicated the actor etc.
Easy, just do the opposite of what you do when it's picked up
I'd make an OnDeath dispatcher on the pawn and the bomb binds to it on pickup so it knows when to release itself and go back to being a pickup
Or the pawn can have a variable MyBomb or MyPickup and tell it to detach when the pawn is killed. Either way.
did what you said
and its not replicated
without loop
now its working I did this moved it to bomb
from controller
What is the correct way to check if execution is on a dedicated server vs a listenserver vs a client?
Checking against ROLE_Authority doesn't work because that is both dedicated and listen servers, but I don't want to allocate client-side resources on a dedicated server (e.g. a player HUD)
You'd make the ShowCountdown event not an RPC
Basically on every machine, the Bomb tells the UI to show the countdown. That's it
Bomb on server:
Overlap -> Change state -> Multicast
Bomb Everywhere:
Multicast -> tell local UI to show countdown
OR
Bomb on server:
Overlap -> Change state (repnotify)
Bomb Everywhere:
RepNotify -> Tell UI to show countdown.
Either way, the ONLY networked thing is the repnotify or multicast in the bomb. that's it
thank you I will continue in the morning last thing I am worried is how to pass time from bomb to widget i except i need make count down on bomb side
and just multicast value
10 9 8 7
maybe the issue is that I should be placing HUD and other client-specific stuff in the PlayerController instead of the players Character
but where is the PlayerController :x
repnotify my dude
i should go sleep and rest, thank you for all conversations u cant imagine how much u helping me even i look dumb every time
thank you I really appreciate your time
will continue tommorow
much love
Well Widgets don't exist on dedicated-server, even if you try to do that you would be notified. And to answer your question, beside Roles there is NetMode
So you can check IsNetMode for example
thanks, I will keep that in mind. it would be simpler to just add some NetMode checks against dedicated server then, although I am now in the middle of moving all of the client-specific code to PlayerController. granted, I haven't fully figured out how that will fix the problem yet, so I might end up needing NetMode regardless?
What do you mean by the client-specific code?
things like, displaying "Press [Action Key] to Interact" on screen
PlayerController would have code that naturally belongs to it
PlayerController is like the interface between the human player and in game player
I'm just trying to leverage the fact that the client owns PlayerController
so maybe I'm doing a dumb thing
You could look into the engine source to see what is there already to get a better feeling of what should exist there
that is a good idea
For example I wouldn't have HUD stuff in PlayerController
HUD/Widgets exist inside HUD class
HUD is a good manager for Widgets and is also easily accessible from PC
for some reason I was discouraged from using the built in HUD functionality, so I've just put it into the character since that was easy
probably dumb in hindsight
HUD is a fantastic place to put that stuff but in lyra UE is starting to move awway from the HUD class idk why
Also to answer your past question, you don't really need to check against NetMode to make sure you're not on dedicated to be able to add widgets safely. You can for example mark your UFUNCTION with BlueprintCosmetic and it won't run on dedicated
oh
Yeah Lyra is changing all the standards
But I wouldn't take Lyra as an example to build on when I'm solo deving
It's meant more towards AAA teams tbh
Hey all, I'm having a strange problem. When I change input modes from UI to Game on client the E key (which is my UI confirm key) does not work on first press, but then works normally. For the host (listen server) there is no issue. I'm using Common UI and enhanced input. Any help is appreciated - I'm not even sure where to start
Key events are all local so idk what might be causing the discrepancy
how do you check the android packaged version number in your game in BP?
i want players to not be able to join multiplayer rooms if their packaged version number does not match
they left the server?
Okay, I think I figured it out finally. All I need to do is check if a character is controlled by the player controller, and if so then run the logic of adding the HUD elements
Question is, how do I compare instances of ACharacter against one another?
wait so the character isnt even possessed when BeginPlay is called. oi. at least PossessedBy() should work
Hmm I'm having quite an issue with ServerTravel, I tried to read all the docs I could on it but...
- I use GAS for all my stats/abilities and I believe everything is correctly replicated
- I have this inventory component on my PlayerController - when you pick up a weapon it goes into the inventory and this is all replicated and other clients can see the equipped item on the player and whatnot
The problem is when I use seamless travel, it does not seem like my PlayerControllers are persisting and the pawns are completely reset (as is the inventory)
however, I've already double checked that I have a transition map and seamless enabled across all my gamemodes (but I'm using all the same game modes)
PossessedBy does work. Its Server Only IIRC.
Do I really need to move my inventory system to PlayerState and then do CopyProperties kinda stuff?
You should be using the AHUD class to initialize HUD Widgets.
The PlayerController also has a similar CopyProperties function like the PlayerState. However i cannot remember what its called.
would that include functionality for playing local interface sounds and things
rather, is that where you would put that kind of functionality
If a UI element needs to produce a sound, that element or its parent should be triggering it.
UI is all Client side per Client.
isnt the ControllerSwap?
Not sure i understand what you mean?
I'm wondering if there is any other times where I would have client side behavior that should be local to a single client that isn't interface-based
Plenty.
Anything that is Predicted is Client side behavior for only that Client.
good point
Oh forget it, there is a SwapController or SwapPlayerController but it is in Game Mode, not on the Controller class
I was researching into that! I see that is on the game mode -- though the docs state that you shouldn't need to copy if using the same game mode....
Generally its advisable to always setup copies anyway.
Interesingly enough -- EventOnSwapPlayerControllers does not get called which means the PC is not actually swapping out...hmm will have to do more research
It's because that was my mistaken. I though the similar CopyProperty function that @fossil spoke mentioned was "SwapPlayerController" but this SwapPlayerController function is executed on the GameMode.
You should probably use the SeamlessTravelFrom function. This one is inside the PlayerController
SeamlessTravelFrom is what I was thinking of that i couldnt remember the name of.
interestingly enough https://docs.unrealengine.com/5.0/en-US/API/Runtime/Engine/GameFramework/APlayerController/SeamlessTravelTo/ I can't seem to call/find that from BP in the PlayerController lol but it does mention
not called if PlayerController is the same for the from and to GameModes
btw thanks @fossil spoke and @edgy patio for helping out* -- extremely helpful in at least diving into some of these as I was going a little crazy why it wasn't working lol (still isn't but maybe getting closer)
No problem, I'm trying to figure out how to deal a kind of similar problem
Maybe this guide can help you figure out https://wizardcell.com/unreal/persistent-data/#persistent-runtime-data
I'm not sure in your game, but I probably would make my own CopyProperties to handle the inventory data.
You could override the GameMode's HandleSeamlessTravelPlayer function to call your custom CopyProperties.
But in this way I am implying that the inventory will always exist and should be persistent, otherwise you wouldn't Copy anything and you would lose your data
I want to replicate the movement of actor, In the blueprint of this actor, I add the "switch has authority" macro so that i can run this code only on the server in order to replicate..
Am i doing right??
you know, I guess this makes sense, but I just now realized that repnotify variables do not call the notify function on the listenserver, but that is kind of annoying
been going crazy trying to debug that
Generally you don't really want to call OnReps on server code. If you need to do the same thing in server and client code, you make a new function and call that from the setter and the OnRep.
It makes debugging replication stuff a lot cleaner because you can know easier if you're actually getting onreps on the client and can run through the callstack easier with a breakpoint in the server setting code or the OnRep to know if you're on client or server.
The Blueprint style of calling OnRep on the server automatically is generally frowned on.
Good to know, I don't know anything about blueprint logic really
Is the repnotify function unconditionally executed as multicast?
DECLARE_DELEGATE_OneParam(DelegateName, Param1Type) it is safe to pass one of these as an RPC parameter, right?
hm ok
There is a difference between bp and c++ here
You should think of blueprint onrep as property changed, not replication callback
Because that is exactly what it is
Only dynamic delegates can be serialized, but even they cant convert object pointer to netguid iirc
I think it will be OK to just use the delegate and then invoke an RPC afterwards
honestly, I have no idea though
Delegate basically comes to invocation list of functions
yeah, I just wanted a callback function basically
That doesnt translate well over the network
You have delegate as a member in dame class as rpc
You have each machine bind their handlerd locally to it
Then you rpc just broadasts delegate member
it's just tricky since sometimes a server is a client, sometimes it isn't, and I have no idea anymore when what is executing where
I did like this...
Mobile, cant view screens really
If I move the project to another computer, do I have to redo the dedicated server build as well?
Not if you also moved the dedicated server.
but i have this error " Client target not found"
Server rpc called from listen server host is just a normal function
That gets executed normally
Thank you! I selected the unreal client botton instead of the botton of unreal game!
There is no tag but only component tag.
Can i use component tag as same concept when i use tag?
is it possible to cast from repnotify to widget?
where I want change value?
You call delegates. Widget should be bound to them. Gameplay classes should have zero reasons to ever have a pointer to a widget.
When RightGrip is input, the repnotify variable R_Rock becomes true, and when R_Rock is called, the repnotify variable of BP_Pulse becomes true.
START changes to True, and then I made the code like the third picture run, but it doesn't work,,,Could you give me some advice?
Is it true that with DOREPLIFETIME(Class, Array) changes to the array elements (using a pointer or reference) doesn't trigger OnRep_ methods to be called? But if using DOREPLIFETIME_CONDITION_NOTIFY(Class, Array, COND_โฆ, REPNOTIFY_Always) changes to the elements to trigger OnRep_ methods on clients (like the user writes here: https://forums.unrealengine.com/t/repnotify-for-arrays-not-triggered-when-modifying-a-contained-value-by-reference/117036/2?u=aperfectmisterman).
I have been foolishly making changes to elements in a TArray of USTRUCTs (mutable structs, buuuh!) and having problems with replication. Is this the reason?
I think I will move to just assigning new elements to the TArray to avoid using mutable structs, should fix the problem as well, right?
guys I am trying to remove widget by multicast when I start new countdown but I still have both there I am just using remove from parent on multicast.. ๐
trying it like this but not working
Don't mix execution lines like this. Save the widget into a property, and use that to remove it.
i saved it and also didnt help
when I tried use remove all widgets
it worked
but I deleted all
i need just that one ๐
Sounds like you have created too many and are only removing the last created one.
I am creating on all clients
and also I need remove on all clients
here I am creating it
I am trying to add there remove from parent
before add to viewport
but no effect
weird
Where is this multicast broadcast from?
What on the server calls it?
remove ?
The Multicast.
that multicast is connected to this authority
What calls that though?
What is the event to the left of the HasAuthority?
actor begin overlap
its bomb picking
so I am doing it on server
so noone can cheat
but remove from pparent should work
after multicast....
Quick dirty check. Put a DoOnce before your CreateWidget node. And try it again.
I'm assuming something is calling your ClientsCountDown multicast too much and you're not checking if the widget is already created and on screen. Possibly leading to multiple widgets that look like one. So RemoveFromParent is only removing the last one.
weird result
second countdown didnt even start
bcs of do once
Try this then in your multicast. It'll only create your widget once. And will not try to add it if it's already in the viewport.
ah I am retard I first need solve how to sync time because now I have timer inside bomb and also own timer inside widget both have time 30 sec but its not synced I should set timer from bomb and do not let widget to count
its foolish solution
thx
I'm replicating some teams structs, but the PlayerStates that I use to refer to players are nullptr on the client. I assume this is because playerstates are not yet replicated at that point?
Prolly. They take more time to replicate than other actors
I'm getting insta kicked after trying to join the lobby on EOS, enyone had simillar issues before?
LogNet: Browse: EOS:0002812933264bd788f4dbbffcb75940:GameSession:97/Game/Maps/SP-MainMenu_Placeholder
[2023.01.29-15.58.32:206][252]LogInit: WinSock: Socket queue. Rx: 32768 (config 32768) Tx: 32768 (config 32768)
[2023.01.29-15.58.32:206][252]LogNet: Created socket for bind address: 0.0.0.0 on port 0
[2023.01.29-15.58.32:207][252]PacketHandlerLog: Loaded PacketHandler component: Engine.EngineHandlerComponentFactory (StatelessConnectHandlerComponent)
[2023.01.29-15.58.32:207][252]LogNet: Game client on port 7777, rate 120000
[2023.01.29-15.58.32:210][253]LogSockets: Warning: GetAddressInfo failed to resolve host with error SE_HOST_NOT_FOUND [11001]
[2023.01.29-15.58.32:212][253]LogNet: UNetConnection::Close: [UNetConnection] RemoteAddr: , Name: IpConnection_3, Driver: PendingNetDriver IpNetDriver_3, IsServer: NO, PC: NULL, Owner: NULL, UniqueId: INVALID, Channels: 0, Time: 2023.01.29-15.58.32
[2023.01.29-15.58.32:212][253]LogNet: Error: UEngine::BroadcastNetworkFailure: FailureType = PendingConnectionFailure, ErrorString = Your connection to the host has been lost., Driver = PendingNetDriver IpNetDriver_3
[2023.01.29-15.58.32:213][253]LogNet: Warning: Network Failure: PendingNetDriver[PendingConnectionFailure]: Your connection to the host has been lost.
[2023.01.29-15.58.32:213][253]LogNet: NetworkFailure: PendingConnectionFailure, Error: 'Your connection to the host has been lost.'
[2023.01.29-15.58.32:213][253]LogNet: DestroyNamedNetDriver IpNetDriver_3 [PendingNetDriver]
[2023.01.29-15.58.32:216][254]LogNet: Browse: /Game/Maps/SP-MainMenu_Placeholder?closed
Doesn't seem like you're getting kicked. Seems like you never connected.
Warning: GetAddressInfo failed to resolve host with error SE_HOST_NOT_FOUND [11001]
hi
Hey guys - does anybody have an article or reference related to how UE serializes variables before dispatching them through the network?
I'm more curious about fstructs specifically, but anything helps
It's just a stream of bytes per certain 'action', those streams are referred to as "bunches" within the Unreal source. Then actual packets contain those bunches, whether that's one bunch, a part of a bunch, multiple bunches or a combination of all of that. Serialization depends per specific object on how it's done, a Vector does it different to for example an entire struct. You might be interested in reading this as an example if you have source access: https://github.com/EpicGames/UnrealEngine/blob/release/Engine/Source/Runtime/Engine/Classes/Engine/NetDriver.h#L187-L218
Structs in specific if you don't do anything else than marking things as a UPROPERTY and mark that struct as replicated somewhere within an actor will use 'Delta Serialization', which I suck at explaining lol. If you use a custom net serializer within C++ you can disable that behaviour. But that's something you need to explicitly do.
Hey @twilit radish - thank you for your inputs. All of that was helpful. ๐
I think it is also possible to 'customize' how a struct is serialized by implementing one function (forgot the name)
Is it possible to use duplicate player names when calling NewController->PlayerState->SetPlayerName(...)?
For example, I spawn three of the same monster AI class and I want them all to be called "Muffin Monster 1" - would I be able to call NewController->PlayerState->SetPlayerName(FString("Muffin Monster 1")); for all three or would that cause problems?
Probably yes (it would work)
When user join in Session and executes UpdateSession() in PostLogin(), Session is not found in FindSession()
what's the problem?
How can I make the other player see what costmetics you have? As the client only sees their cosmetics on the other player
The costume is selected by the player using enums
Just a sanity check - if I ask for HasAuthority() in the Player Controller, it will only return true for the clients or, in the case of a listen server, for the PC of the listen server player, right?
I'm doing some client-only setup that runs on info from GameMode so
HasAuthority() checks if the local network role is the authority. Which for a player controller is only on the server.
ok then I was doing it reverse xD
Then, for some code to run on the client version of the PC, I have to check that it does not have authority
But then it is possible that the listen server doesn't work properly
Correct, listen server will then break.
This are not RPCs
You don't have to run it as an RPC. IsLocalController can be used for the client.
oh for listen its different
Ahhhh will that work for ListenServer as well then?
Yes, it checks if it's locally 'controlled' aka will only run whenever it's the client or the listen server but only for their own controller.
Hi, i have problem with multiplayer event replication, i have 3 clients, client 1 and 2 are working as intended, but somehow when client 3 is posting message server side event wont fire(ServerSendMessage event), even if local event fire (SendMessage)
i'm using option to play as client, dunno why 1 and 2 client works but third one don't
How are you getting the PlayerState for 'SendMessage'?
From widget
This part in widget fires as expected, then in player state it fires local event and then server event but only for client 1 & 2, on client 3 it does nothing
also in 4 clients scenario: client 1 2 and 4 is working just fine
Can you instead of the Get Player State node try this?
it worked, but why?
My guess would be because Get Player State with the argument 0 grabs someone else's PlayerState. That method internally just picks the first item inside the Player Array that the Game State stores and grabs the player state. I don't think that one necessarily has the correct order because people can login at any time in any order. Which seemed likely to me if the network call failed because you can't call methods from an actor on the client which that client doesn't own.
GetPlayerState(0) will just return the first player who got put in the Gamestate's PlayerArray.
thanks for help, back to learning magic world of networking
Trying to get other clients to play the ADS animation.
Player replicates its current state (Aim, Walk, etc..), in animBP, I check that the state is Aim. If so, I blend in the aiming animation. Otherwise I don't. Works correctly locally and the server can also see it. However - other clients cannot. I have confirmed that the true branch fires off. Any ideas?
What's beyond the true though? If that does fire something else must be messing it up I guess.
Show your code for selecting the costume
Is the standalone play mode "safe" for testing multiplayer, in the sense of being very close to two real players from different computers?
I'm testing something that doesn't work in PIE (due to shared render target that should be different for every process) and it's not working in standalone, and idk why
See - true branch plays. Top right is client 2, middle is client 1, and the ABP is showing the route of Client 2, from the perspective of client 1.
So they SHOULD be doing the animation
The event is called at the start of the game (when the map loads)
Don't store the costume on the game instance
Or rather
you need to get the costume from game instance, pass it to server, and set a replicated variable
then the repnotify of that variable is where you'd actually apply the costome
Where to?
The gamestate?
.
Client tells server which costume it has
Begin Play -> Is Locally Controlled? -> get enum from gameinstance -> run on server event
Server tells everyone which costume to use for this character
Run on server event -> set MyCostumeEnum(replicated, repnotify)
Everyone applies the costume
RepNotify -> actually set costume on mesh
.
Client passes costume enum to server which sets a replicated variable and everyone uses that to show the right costume for that character
Could I not just set the variable as replicated?
You do, but that can only be set FROM THE SERVER
The ones in the gameinstance
do you want each client to say which costume it has?
Yeah
then it needs to tell the server which costume it has. Step 1 in what I posted
the server has its own gameinstance and knows nothing about the clients gameinstance unless told
Idk it seems a lot of work to have to save/load the variables in the client side variables then have another one for the server for each variable
welcome to #multiplayer
Fr dude i'm losing my shit ๐ญ
You could have a savegame or gameinstance on the server keep track of what each player has, that'd be server-side inventory basically
But i'm almost there
but do what I spelled out and it'll work
Alrighty
This is all in the gamestate? Just making sure
all in the pawn
Got it
Fixed my bug. Was something else. I was returning early in my OnRep in C++ that would execute a delegate that provided important information. So, bug was a delegate wasn't being executed due to exiting too early.
should i be binding delegates on the server or client?
No definite answer. You bind them where you need them to be fired/called
Hmmm - what could cause a widget to not show after doing a seamless server travel? Can't track down why my pause menu does not show up anymore after traveling.
HUD begin play calls Remove All Widgets to be safe. For w/e reason - it's being really weird about the 2nd branch statement. Claiming that it is active, even though it isn't.
Just in case this is useful to anyone out there who is using replication graph and wondering why their non relevant actors are replicating when multicasts are called. There is a map where you can set the default behaviour for multicasts and whether they open channels or not. The actor is set to true by default meaning it will open a channel for a multicast. If you want to stop this behaviour you need to add this inside InitGlobalActorClassSettings.
This is what the IsPauseActive function does. It is reading it as a valid object after seamless travel. And this even happens if I never even create the widget. So weird.
Alright - this part of the HUD is all jacked up after doing a seamless travel.
Wait - so BeginPlay doesn't get called on seamless travel? (for PC)
no, actors retained during seamless travel won't have beginplay called again
BeginPlay gets called when the actor is spawned. An actor that still exists from seamless travel isn't newly spawned.
Well - that explains my funkiness most likely. Must still be holding on to some garbage references.
Yup - that was it. Glorious
@dull lance Yeah - I know. It gives you the controller that is travelling though. So I'm doing a client RPC on that.
controller->clientRPC()
Well - I answered my own question. This is in the base implementation for the method. So it should be good as long as super is called first.
It's 578 for me ๐ค
Well - it should be safe. Because HandleStartingNewPlayer is after PostLogin (I know PostLogin doesn't get called for seamless) and PostLogin is first place it is safe to do RPC
This is the bottom part of the function.
Won't be for a few days until I can properly test it working in a real-world online scenario though.
@dull lance My idea was to do this pretty much. Have a way to reset things on the PC itself. Instead of only having the methods in the GameMode. So far, this works in packaged singleplayer. Will let you know in a few days if it works multiplayer. That's when we're doing our network playtest.
Hi, I'm trying to get the multiplayer example from this documentation: https://docs.unrealengine.com/5.0/en-US/multiplayer-programming-quick-start-for-unreal-engine/ to run
I just want to see step one work and see 2 players in the same game
Following the instructions just starts 2 copies of a single player thirdperson game example
You likely didn't set the PlayNetMode to ListenServer
Hey Guys
In Mobile
Create Session Is not working
This is my Bp codes for this
I'm not using Any Online Subsystem Except Google
How To Fix It?
I'm pretty sure Google has non Session Subsystem
does cross-platform automatically work for dedicated servers? like if an xbox and playstation tried to connect to the same server ip address will it work and they'll be able to play together?
Should do, I think.
interesting...
I don't have access to the devkits, so it might be a case that they require specific platform-based session stuff which is incompatible somehow.
oh ok. thnx!
I mean Fortnite, PUBG for example do it so considering that I would very much assume you can 'just' do it ๐
I don't see how that changes anything though. Something still has to handle different clients from different platforms if that was the case.
I'm just saying that's the only potential issue... not that it definitely is one ๐
@uncut atlas @twilit radish @latent heart UE blocks different UniqueNetIDs
If your Server uses NULL, Xbox uses Live and PS uses whatever they have, then you will not be able to join
If all of them use NULL then it would work, but with NULL you lose all other things that Subsystems offer you
That's why stuff like EOS exists and is required
it acts as a central UniqueNetID for different authentications via e.g. Steam, Xbox, PS
You don't have to use EOS for this. I totally get your point and didn't realise NULL doesn't accept the IDs, but there's absolutely nothing stopping you from authenticating people your self without EOS. Or.. Alternatively if you don't care about authenticating at all just not doing it.
But I can see how EOS is convenient to use yeah.
Yeah I didn't mean that EOS is the only solution
But EOS was mentioned
void AGameModeBase::PreLogin(const FString& Options, const FString& Address, const FUniqueNetIdRepl& UniqueId, FString& ErrorMessage)
{
// Login unique id must match server expected unique id type OR No unique id could mean game doesn't use them
const bool bUniqueIdCheckOk = (!UniqueId.IsValid() || UOnlineEngineInterface::Get()->IsCompatibleUniqueNetId(UniqueId));
if (bUniqueIdCheckOk)
{
ErrorMessage = GameSession->ApproveLogin(Options);
}
else
{
ErrorMessage = TEXT("incompatible_unique_net_id");
}
To be honest I should have realised this as I looked at this specific code like a whole 2 days ago ๐คฃ
I was implementing my own matchmaker and was rejecting logins and ran into this specific Super I had to deal with ๐
Ha. So I was right! ๐
Well actually, technically Unreal can do it just fine without stupid IDs ๐
๐
virtual bool IsCompatibleUniqueNetId(const FUniqueNetIdWrapper& InUniqueNetId) const { return (InUniqueNetId.IsV1() && InUniqueNetId.GetType() == GetDefaultOnlineSubsystemName()); }
For completion
Do the subsystems even authenticate with their platforms in the first place btw? Or do they just accept whatever you throw at it.
Depends on the Subsystem, but they should auth
Steam for example calls Steam_Init or so somewhere
So it's just dedicated servers that are special I suppose assuming we are using multiple platforms.
Usually yes, cause they are the middleman
But again, all clients must share the UniqueNetID type
Could override it though. But yeah.. By default that's a RIP.
It was allowed before 4.24 or so
It caught me offguard back when it was changed
But the ID is used in multiple places, so I wouldn't think it's a good idea to play with different IDs anyway
I mean there's a command to disable it if you really want to.
Yeah I just don't know the problems that could arise
And overall it's probably better to just plan ahead of crossplatform stuff
Especially with options like EOS being free
Even if you get them to connect, you still lack things like shared Friendlists etc.
There is more to it then just the server connection
But friend lists etc. are not going to work from a dedicated server either way.
Like you can't even query another profile
A game like fortnite allows meeting in a lobby before queueing
Oh you mean from like a player perspective where it's just easier to find your friends?
For example
You also can't really query player profiles. Imagine you have a post-match list of games that were played. Outside of a networked environment.
Ah alright, I thought you meant the server accessing that and was confused for a sec ๐คฃ
Sony Players couldn't query a SteamID profile
Na I mean overall experience
Peeps nowadays can be happy EOS exists
I mean that's not necessarily a problem IMO. Don't see why a dedicated server can't pass on stuff like profile picture or a nickname etc.
But yes, I get the general problem ๐
Fair enough.
You can work around it of course by saving those things into the cloud and just given a "hardcoded" list. But it would be easier to just point to the users ID
So the Client can even look at their profile, invite them to a match etc.
It's definitely more convenient yeah.
But yeah, we are on the same page :D
Could technically do it all your self if you want to, but it's just more convenient to have EOS or whatever do it yeah.
I think the big headache that a lot of people would have is "How do I even make my own UniqueNetId with my own backend?"
Which I can't answer without looking it up either
Probably needs a custom Subsystem implementation either way
Definitely needs a custom OSS yeah. The engine depends in too many places on that interface. And honestly probably a good idea anyway if you want to swap it out xD
Would be fun to have an open source subsystem but a lot of work
Also can't guarantee it's safe, cause I'm not good with the webdev part of this
So a self-hostable
Surprising this doesn't exist yet, but I guess people are too tied in with the existing ones or just use EOS at this point
Would be fun to try it though, but I would not make it open source my self honestly. Sounds like a good way to get a bunch of people not knowing what they are doing on your github page asking constantly for support ๐
Honestly you could easily monetize this as a company:
Create the software, host it for people that want to use it and let them pay for it, create API endpoints etc. so they can interact with and you just got your own platform system.
But then again, that's basically EOS at this point I suppose. Maybe it's better suited as an open source project yeah.. ๐คฃ
You mean Gamesparks, PlayFab, and what they are all called? :D
maybe
I would rather just make it open source and not give support beyond accepting properly discussed PRs
I don't want to earn money with it
I even have a Plugin + MasterServer sitting on some Repo somewhere
That we never released
Way too much headache to market this
Rip.
yeah. We are integrating Valve's open source sockets for p2p since we are not using Steam
but I bet most people use the pre-made solutions like Steam or EOS, it's just way easier
Iโm setting the playerโs camera location on Event Tick, and the clients are jittering around with the code activated.
I tried running the code through a custom event from server to multicast, was a small improvement but still not great. It made me think that the tick on the server might be different than the clientโs - is there a best method kinda deal when working with event tick?
But that can't be used to Multiplayer right?
Does Eos Online Subsystem From the Marketplace provide Matchmaking, Matchmaking server?
it supports matchmaking, but I'm fairly certain you'd need your own server.
Pay money to somebody like playfab
Okay Now There's a Doubt
Join session. ,create Session code is done
For that to work
https://docs.unrealengine.com/5.1/en-US/using-the-network-profiler-in-unreal-engine/ is the engine compiled with "STATS" macro defined as nonzero by default?
We have to implement online Subsystem Eos
Making a MP game as your first game when you don't know what a server is or where you might host servers isn't ideal.
can you do P2P matchmaking instead?
I understand
But this isn't my first game
This is my first Mp game
I think dedicated servers are probably overkill unless your game is going to sell a ton of copies
But this is correct?
Now Won't Epic Online Services Themselves Won't Provide Servers?
servers are $$$
Session / Session hosts only provide ways for people to talk/connect, not to play.
So Eos Won't Provide Any Servers so Multiplayer can't happen with it alone?
Correct.
it can if you have a listenserver player right?
Not to Play . hmm..
Sure. That's the other option. Don't have private dedicated servers. Let people host their own or use listen servers.
Is it?
there are downsides to p2p player hosting but it's a looot cheaper
Okayy That's what I want
You only need to pay for a server if you run it. Lots of games get by with a limited number of self-funded public servers and then let people host their own.
Now There's no need for $$$ thing for Listen server ?
Nope. That's run by your players.
However, they aren't ideal.
They rely on players have good internet connections.
It's implemented by default. UE supports listen servers out of the box.
In fact, it actually doesn't support dedicated servers unless you download the source and compile yourself.
Is it??
Okay So For Multiplayer to work in mobile after doing the codes
I just have to implement Eos Online Subsystem?
A phone probably won't be able to host a server.
And It would work?
They will have bad internet.
Now why is that?
You can host with a Phone
Just that Google has no Session stuff
That's why they want EOS
Ok That Depending Isn't it?
EOS will handle the Sessions just fine, but your Phone will need to host as already explained
Ok So We Just Need to Implement Eos Online Subsystem.?
Sure, it's possible. Maybe they're playing at home or in an area with good connectivity. But as soon as you go through a tunnel, boom, your server is offline.
More or less, yes. EOS is a central place for crossplatform stuff.
So you also have to deal with the authentication. I can't recall what they all offer, but I'm sure there is auth via Google
So you'd authenticate with your Google Account with EOS (linking it affectively)
Yeah They have to Be Online To Play Online Games Ryt? So their problem right?
But after that it should just work. I haven't dealt with EOS yet though
It's also a problem for everyone connected to their server who have no suddenly been disconnected.
Oh I C
Oh
Ok Like Let Me Check The Steps ,.
- BUYING Online Eos Subystem
From the marketplace
- To Add Client ID and things.. in the dev epic games website
- is where you will most likely encounter problems
Phone connections are just unreliable by nature, imo. They're fine for web browsing because it's a lot of discrete connections, but they don't do consistency if the phone is actually be used outside of the home.
- To Tick Online Subsystem Eos
the process it not documented and the error messages are unhelpful at best
So the first time you set this up will be painful until you get it right
- to implement IDs and things in Project settings.
Also be aware that you cannot release your EOS-game as a demo to the public
before epic does brand verification ONLY people added manually to your epic org will be able to use the game
that is a big disclaimer that is not mentioned anywhere
Demo?
you have to buy EOS?
Like Releasing the Game is a problem?
yes like if you were trying to pitch a MP game to a publisher
People wont just be able to use it
Epic needs to do brand verification on your game/company before anyone can play the game
You don't need to buy EOS
before that only people in your epic org can use it
What you find on the marketplace is probably Redpoints Online Subsystem Integration
ah
Which exists for free too, but then you won't get any Support
Yes , isn't it I couldn't find free version,
Idk if Epich as their own subsystem by now for it, but the Redpoint one is supposedly better anyway
Support?
Yeah, if you have trouble with the Plugin itself
I recommend buying one of the market plugins. it is not worth the time to deal with EOS raw
If you don't pay for their license then you are on your own
Ohk
Ok so the free version can be used however we want?
So for example, we had EOS and I wasnt aware of these limitations, so instead of being able to give the publisher a live 2P demo, we recorded a video of us playing internally and showed that off
You'd need to read up on their license terms
Yes.
Oh
Might be that the free version doesn't support other platforms
You either pay for it with money or time
They say "console" but not sure what that means
Depends on what is more valuable to you at the point when you have to make the purchase
If you're a developer earning less than $30k USD/yr, a Free edition is available. Check the website to see if the Free edition is right for you.
So you'd need to pay if you earn too much either way
Now What If we suddenly become a developer earning more than that?
Ohk
You have to get the paid version
What??
Ok So It's safe to buy the free version?
You can also do this all without their plugin, but then you have to integrate EOS yourself. Not sure how far epics own subsystem is
EOS is a third party library from Epic Games. The Marketplace Plugin integrates this and adds BP nodes etc.
You can do what the Plugin does yourself, but that's a lot of work and needs a good chunk of C++ knowledge
Oh Ok Not That Good In C++
Yeah then you don't really have a big choice here :D
Yeah
If you are serious about your phone game then you might need to invest into the plugin
Yeah I'm pretty serious
You can try if the free version works for now, but I don't know if they support Google in the free version
I'll Buy The Paid Vee
So After Buying it
I don't need to change any codes in the Bp right?
Can't promise
Have never used EOS or the Plugin
Might need custom Session nodes that the Plugin provides
That's up to you to research first
Is it?
Oh Ok
Thanks Man
And Thanks Guys
I'll check how to do it and Reporrrt it to you
was trying to view the packets flying around in here I dont see any actors but I know I'm getting replication working perfectly fine?
prob has to do with this stats macro not specifically called out during my engine build? shrug
So overall minor / not too many changes for free performance. I'll take it lol. Except rip replication graph I suppose.
too bad, many network engineers I knew suffered a lot because of rep graph ๐คฃ
another day I thank god for not being interested in low level netcode
๐
And still no TMap ๐
improve the performance, scalability, and maintainability
Until benchmarks are actually shown - to me, this is a big nothing burger.
how can I tell if the current controller is the Listen Server?
GetNetMode()
?
That one yeah, but that also triggers for a dedicated server. Depends on if you care or not I suppose.
I think also for Standalone? Pretty sure it just checks if you're not a client.
It does yes. So it returns true whenever the current process is either the listen server, a dedicated server or running in standalone mode.
Isn't the reason they do the networked stuff through the character for the CMC is because component replication is heavier than what they are advertising? ๐ค
Yes, but that's because they call a whole lot of RPCs inside the CMC. At that point it does actually matter and for a few RPCs or whatever it really won't matter. So probably why they used "relatively low" ๐
But you can still use just the actor I suppose.
IIRC every frame until 60 when it starts to combine stuff(?). If I remember what Cedric said at some point ๐
The networking model in unreal still confuses me. I thought I understood it, e.g. this function runs on the server, this function runs on the client.. but then for listenservers ๐ ?? and so you remove all of the checking to see if you are on a server or a client to make things work but now everything just runs everywhere unless you mark it with a macro to be server or client specific and thats great except then things randomly just don't work on clients and i don't know
Far easier to do these guards in C++
But you can just do the checks that I mentioned above in BP and it'll be fine
if (GetNetMode() == NM_ListenServer)
If you set it up right it should Just Workโข๏ธ in standalone, listen, dedicated, or client
yeah, I just don't know how to set it up right
or if (GetNetMode() < NM_Client) - will run for all servers/standalone
I went thru the unreal networking docs, read a bunch of the stickied stuff, thought I had it, but I don't have it
You might be better off thinking in terms of authority, locallycontrolled, and neither
standalone is authority and locally controlled
listen server's pawn is authority and locallycontrolled
clients pawn on clients machine is not authority but is locally controlled
etc etc
if (GetNetMode() < NM_Client) this is the only check I'm using now
I can check for authority pretty much anywhere, but it's hard to check for locallycontrolled unless I have a character reference which is cumbersome
The only things that usually would be locally controlled are pawn and playercontroller
if (GetLocalRole() == ROLE_SimulateProxy) - you are a client, EXCEPT in the case of controller/pawn. They use ROLE_AutonomousProxy for the local player.
I am going to save this conversation and go reread some of my project code, perhaps this will be useful
thanks
I used to think that the ROLE_AutonomousProxy would be applied, even for say, the weapon used by the pawn. But it did not seem to be the case the other night.
Maybe on the long run saving bytes also help for server costs
for 100 players
Bandwidth can get expensive I would imagine with 100 players xD
Guys
I think I have Set it up
But The Create Session Fails , when opened in Standalone
CPU tends to be worse
Subobject replication is really expensive, yes
Does PostNetInit get called after a seamless travel? ๐ค I'm wagering no.
yea my server empty is at 10% cpu, 1 player joins, and it jumps to 50% ๐
For what actors?
Ones that would've been in the travel list
Usually yes
As pc and ps tend to get reinstsntiated
Yeah - I guess that's fair.
Pc travrl list is usually empty
And other actors are persisted only on server
why i cant see my friends lobby when he hosts a game, and he cant see mine when i host, it works locally tho with the same network, but wont work when they are 2 different networks, how do i fix that?
PC not calling BeginPlay after SeamlessTravel still annoys me
It is a weird choice
Are you using a Subsystem?
yes
Which one
the base one
The base one doesn't support Sessions outside of LAN
Sessions require a MasterServer aka SessionList
There is nothing you can add or request Sessions from with the NULL Subsystem
You'd need to use e.g. Steam
Yup - this tripped me up last night ๐
I'm sure i still have a bug in the Lobby kit cause of that
But it works cause I never travel from Gameplay to Gameplay
alright thank u so much
PostNetInit is called as part of client spawning a replicated actor
I have a component that binds OnBeginOverlap/OnEndOverlap. It is attached to random BPs in the world. When a listenserver character enters the region, OnBeginOverlap is fired off with authority and everything works great. When a client character enters the region, OnBeginOverlap is fired off WITHOUT authority and since the component is not owned by the invoking client I can't even trigger a server RPC. Is there a proper way to fix this or do I need to only bind OnBeginOverlap/OnEndOverlap on the character itself and then have some kind of common interface that I call on the component itself or something?
All collisions are local
The Collision should be triggered on everyone* no matter who walks over it
As in, OnBeginOverlap should trigger on Server no matter if Server or Client walk over it
That was my expectation but logging GetNetMode and GetOwnerRole seems to indicate otherwise
(unless I am misunderstanding something)
Idk what it prints for you, but with 1 Server and 1 Client, you should get two prints if a Client walks into the Collision
Yeah - which is why I would think that it wouldn't be called after a seamless travel.
One for the Server version of the Client's Characer and one for the Client's version
UE_LOG
ty
UE_LOG(LogTemp, Warning, TEXT("[%s]"), *FString(__FUNCTION__));
Something like that
Or whatever else you want to write
Not if the Actor persists on client, weirdest thing with seamless is that ServerNotifyLoadedWorld is called on departing controller
Makes for quite a mess if you have both lobby-game-lobby and game-game transitions
Create Session Fails
A Question , Eos , How To Implementation Listen Server?
Will It Work On Standalone only when it is a Listen Server?
You should not be starting sessions with standalone net mode
You can, but you shouldnt
so, characters are owned by the client, but, is it OK to keep extra state information on the 'server side instance' of the character?
Elaborate
my character presses an keyboard key, this calls some function (bound using the enhanced input action system). my understanding is that this function is executed on the client. I need it to talk to a component that is attached to a BP that is owned by the server. to do that, the only thing I can do (to my knowledge), is run a server RPC on the character itself from the bound input action function. but, at some point at some earlier time, that component needed to register with my character that it was "subscribing" to my characters input events. I suppose I could invoke a client rpc and maintain the list on the client, but I figure I may as well just do it on the server instance of the character since the client doesn't actually need to know about this list, it just needs to exist somewhere so when the input action is fired off and I invoke the server rpc to notify the component I have a list of components to notify
this is a complete jumble to try to talk about
be specific. Your character doesn't press a keyboard key, your player does.
Anyways, what gameplay are you trying to do here?
well, my my player presses the keyboard key, the function that is executed is bound on the character class. In terms of gameplay, I have lets say a water source that the player can drink from. when the player walks near the water, they should be able to press E or something to drink from it
I imagine this will be the model I use for a lot of things, like picking up items from the ground, interacting with doors, chests, etc
so I'm trying to get it as right as can be now
- Client presses interaction
- Do local checks as needed
- ServerRPC the interaction
But, you should really send a pointer to the actor youre interacting with via that RPC
And have an interaction interface
my goal was to have the component register an on interact delegate to be called
If you have 2 interactables right next to each other, server and client might nit independentky evaluate the same actor as target
In pawn:
E -> Choose what to interact with -> Run on server event -> Interact interface call or component event
OR
E -> Run on server event -> Choose what to interact with -> Interact interface call or component event
Depends on how you want to do it but that's the general gist of it
1st, always
Using Advanced Sessions for Steam, if I wanted to create private and public lobby, would I be using a separate "Create Advanced Session" for the specified lobby types I want?
I always do local checks before doing a ServerRPC - can save on unnecessary RPC calls
ok, in that case, I will keep the list of subscribed components on the clients version of the character. thanks
well well well, everything is working now. thanks everyone
hey hey
I want to ask a question so I am having problems with my game for some reason
Iโve been developing a multiplayer game, everything was working properly up until I reopened the project recently, and I was generally able to both create and join a session on the same machine without issue.
Randomly this issue has occurred where everything works fine and loads properly for the player that is creating the session, and they are able to jump into the level with the new game mode without problem. When a second player joined that session before, it USED to work just fine and load the same game mode without problem, but now it is straight up deleting the game mode before it even loads the level. It is still JOINING the session successfully but it is ignoring the default game mode for that level, its not maintaining the game mode from the previous map, thereโs no pawns or controllers from what i can see and even though it has the time of day sky its either spawning the character controller in a really weird place or not loading the rest of the level at all. This would make sense, i guess, since all of the defaults are tied to the game mode itself. Why is this happening???
I have already tried everything I can and I cant find a solution I can hop in discord share my screen and I hope someone can help me
I am Using Unreal Engine 5.0
or 2nd with a sanity check so client doesn't say they wanna interact with 1 thing but interact with another on server
depends on how close together your interactables are
does anyone know what is the cause for the problem
I have been stuck on that for the past 3 days at this point
Client doesnt have anything to do with gamemode
okay so when I join my game now it says the first player has a gamemode but the second one doesnt and it doesnt spawn
First player should get all login events when 2nd one joins
Also, and i cant stress this enough, joining a session is not the same as connecting to unreal server
Those just usually happen around the same time
then is their a reason for the second player not getting the gamemode
?
because I have specified for this map you should get Gamemode_MP but for some reason only the second player isnt getting it
got it
then their must be a reason for the second player to not spawn and I cant seem to figure it out
Show your spawning logic in gamemode, if you have any
otherwise show your default pawn setting in gamemode
i still cant find my friends sessions even after using online subsystem steam
any help please
oh please
Check out my Patreon: https://www.patreon.com/user?u=60713904 Become a member: https://www.youtube.com/channel/UCFjBMoGhlEum8jRgPvmWpJg/join
Join the {GDR}; Discord server and download my free project files: https://discord.gg/dUm3ZtYDuV
Buy me a coffee: https://ko-fi.com/bluntstuffy
Follow me on Twitter: https://twitter.com/BluntZombie
Discord...
this video helped quite a lot when I did it
btw
when i tried to use the latest steamworks sdk
i was doing it by the documentation, it gave me steam sdk not found error
something like that
i then changed the folder's name back to the original version, and the steamwork.build.cs back to the original version but i didnt change the sdk folder back to its original one
I am unsure of that I didnt dabble much in steams online subsystem
I would recommend watching the video fully then trying to see if it works again
alright thanks anyways ๐
wlc wlc glad I can help
Quality CMC extension code, could definitely be shipped ๐
brrrrrr
can't wait to play PaintShaker Simulator 2023
Okay so I asked in c++ but didn't really figure it out. I have a c++ character that is not replicating it's movement to the clients. If I run the game in standalone or listen server then my character moves when I issue a move command to it's ai controller. But it doesn't replicate in client mode
when is replication variables are considered too much ?
Is it like 10 replicated property per actor ? 50 ? 100 ?
I don't think there is a number, it depends on the number of actors, how often the variables change...
efficiently done, Unreal can handle hundreds and thousands of data per second, but that requires understanding the system and your game and context very well
Many thanks ! I will continue researching this topic as well
For anyone wondering, I just solved this. I had to set the capsule component to replicate. The weird thing is that my old blueprint based characters don't have this set but still work?
Like For Testing?
The Create Session Fails on Mobile and Standalone
Why is that?
Even if Lan Is True , It fails
Hey devs , i was watching some video on Crouch on youtube , and what he did is this (Screenshots) and evrything worked just fine both on Server and Client , i donโt get why its crouching fine on Server if the actual crouching code is inside of On_Rep functions . Isinโt repnotify functions should get called only on client?
Use the network profiler tool to find out which actors have lots of waste and should be optimized. You can also use unreal insights for a closer look at the impact of your network related updates on a frame by frame basis.
Will use them, Thanks !
Maybe this is related to Eos Online Subsystem
Online Subsystem Eos is enabled, other Subsystem like steam is not.
Except Google Play, for in app purchase
So Like Why Is Create Session Failing?
Just Want to Know Why.
C++ OnReps get called only on clients, while Blueprint OnReps get called on server and clients. If I recall correctly.
I know this is not strictly UE, but I found a very interesting article about networking:
I skimmed through it, but I donโt think this is useful for most games. They are making the assumption that you can predict what something does and that it does this in a mostly deterministic way. Unreal is not so great on deterministic stuff if you ask me. Along with that games are extremely unpredictable, players are completely unpredictable and AI behavior can change any second based on.. You guessed it. Those unpredictable players ๐
Although I think there would be scenarios where you can apply it to, but I doubt it will matter a whole lot.
Why does the fast array require the variable to be named Items? What happens if you have more than one in a class?
It doesnt, it may have in the past, it doesnt anymore.
i dont understand why initgameplaystats is being called before setupgasdelegates
if (HasAuthority())
{
//setup attribute change delegates
SetupGASDelegates();
//initialize gas on the server
GetAbilitySystemComponent()->InitAbilityActorInfo(this, this);
InitGameplayStats();
}
You might need to give us more context....
when i debug, the initgameplaystats gets called BEFORE steupgasdelegates. these are being called in the possesedby method on the pawn
I dont understand why thats the case?
the whole method:
//Needs to init gas on possessed by
void APlayerCharacterBase::PossessedBy(AController* NewController)
{
Super::PossessedBy(NewController);
if (GetAbilitySystemComponent())
{
if (HasAuthority())
{
//setup attribute change delegates
SetupGASDelegates();
//initialize gas on the server
GetAbilitySystemComponent()->InitAbilityActorInfo(this, this);
InitGameplayStats();
InitInitialGameplayEffects();
InitGameplayAbilities();
UCombatComponent* ThisCombatComponent = FindComponentByClass<UCombatComponent>();
if (ThisCombatComponent)
{
//ThisCombatComponent->InitAvatarActor(this);
ThisCombatComponent->OnDeathDelegate.AddDynamic(this, &APlayerCharacterBase::OnDeath);
ThisCombatComponent->OnKillDelegate.AddDynamic(this, &APlayerCharacterBase::OnKill);
//ThisCombatComponent->TargetActorReplicationDelegate.AddUObject(this, &APlayerCharacterBase::OnTargetChanged);
}
OnInitGAS.Broadcast();
}
//GetAbilitySystemComponent()->GetNumericAttributeBase(URagnaAttributeSet::GetJOBEXPAttribute());
}
}
How are you determining that its being called before? Seems like you are misinterpreting something. It cannot be called before since the function is literally after.
Are there any other networking settings like this? That you can apply to your either character or cmc. https://docs.unrealengine.com/5.1/en-US/API/Runtime/Engine/Engine/ENetworkSmoothingMode/
ahh found some ๐
seems good for now. i need to read more up on this tho. NetworkSmoothingMode = ENetworkSmoothingMode::Linear; NetworkMaxSmoothUpdateDistance = 50.f; NetworkLargeClientCorrectionDistance = 500.f; NetworkMinTimeBetweenClientAckGoodMoves = 0.1f; NetworkMinTimeBetweenClientAdjustments = 0.05f; NetworkMinTimeBetweenClientAdjustmentsLargeCorrection = 5.f; NetworkNoSmoothUpdateDistance = 25.f; NetworkSimulatedSmoothLocationTime = 0.1f; NetworkSimulatedSmoothRotationTime = 0.1f;
probably a dumb not 1 size fits all solution but i dont really see any good places for discussion about these 3 values:
MaxClientRate=15000
MaxInternetClientRate=15000
NetServerMaxTickRate=60
like what is an acceptable rate for a multiplayer shooter... granted ok, you increase tickrate, should make the game more responsive in theory right, but then you can probably host less games (without massive optimizations)
so is its fine jsut setting it to 30?
or this like, a thing of the past and everything should be at least 60
Entirely depends on your game, how well its optimized and your targets.
The higher the tick rate the more performance heavy it will become, the less instances you could theoretically handle.
right, thats what i wonder in terms of costs vs gameplay feel
Its very very dependent on your game. Thats why there isnt a lot of resources that talk about specifics.
Unfortunately.
The ClientRate is just the net speed.
In todays conditions its fine to push that up pretty significantly from the default.
Not sure if this is multiplayer related question but I want to ask how many games that have online servers, do announcements in game from somewhere else
these are default engine settings right?
just wondering.
Its not uncommon for an ingame UI element to read an external API that developers can make "announcements" to display ingame.
Hm thatโs the way
Thanks
So letโs say I can trigger an event from a http request?
Something like this right?
Likely what would be appropriate is a HTTP request to an API like GetMessageOfTheDay, which would return the latest entry in some Database somewhere that contains the "announcement".
Thatโs seems perfect
I have a custom child class of primary data asset that is used as a payload for a gameplay event. the event happens server side and I to do some stuff and then send to payload to the clients via an RPC. however, not to surprisingly, the data asset doesn't go through the rpc and the client just has its event called with none as the input. If I take the same code but pass a string through every works so I guess the issue is in serializing the data asset. Is that just not possible or is there some interface that the data asset could implement that would allow it? In general is there a proper way to pass a primary data asset from the server to the client or should that not be done?
does anyone know how to replicate that code properly
im making a chat box
the print string replicate fine but the widget doesn't have the same text for both clients
can anyone help with this
na that doesnt do anything if its on or off
its the text that isnt being displayed
you can also try running it through a server > Multicast? Thats the only two things i personally would try
I made one in an old project, and i remember going back and forth to get it to show on both. Ill try and find the BP and screen shot
oh thanks
im opening it now, havent opened it in a year so its taking forever
all good man tysm for even helping. i thought it would be ez but ive gotten stuck on this last part
multiplayer is crazy. Its the simple stuff that seems the hardest to do lol
ya thats why i was trying to learn through this
im gonna DM you because its a few pics and I dont wanna blow up this chat lol
sounds good to me do i have dms open?
Widgets don't replicate
Chat should live in GameState or something
UI is a VIEW of the data, it is not the data itself.
Ohhhh that explains a lot
Your chat should go something like:
Text entry -> run in server event in playercontroller -> multicast in GameState or ChatManager
I'm trying to call server rpc in client using UActorComponent that attached to PlayerController but seems like Server RPC doesn't working in UActorComponent even the owner is PlayerController Is there anything I misunderstood for server and client relationship?
Is it a default actor component, or an attached one?
It's attached to playercontroller
But created at runtime or as a default component?
It's default component.
That's odd then. You should be able to RPC even without the component as replicated.
Well, It's not working I think Server RPC function always need to place in playercontroller..
What i was trying to do is separate some ability like interact ability and attack ability to using actor component and communicate with server but those are not working.
Because I really don't want to put all functionality about Server RPC in playercontroller.
I want to organize another way but I assume there's no way to do that..
Am I right?
Well splitting the logic with components, even for multiplayer stuff, should be a valid way to organize things
Are you sure you're using your own controller and not trying to get the owner/controller of the object/actor you are interacting with?
I'm attached component to playercontroller and I'm calling ServerRPC inside of component. Is this wrong?
The Code :
void UInteractibleAbility::Interact()
{
if(IsValid(AvailiableInteractibleActor))
{
SR_Interact_Implementation(AvailiableInteractibleActor);
}
}
void UInteractibleAbility::SR_Interact_Implementation(AInteractibleActor* InteractibleActor)
{
if(IsValid(InteractibleActor))
{
InteractibleActor->Interact();
}
}
It's simple just linetrace to interactibleactor and if player just press e then Interact function just calling SR_Interact function which is UFUNCTION(Server, Reliable)
And InteractibleActor :
Code :
void AInteractibleActor::Interact()
{
SR_Interact();
}
void AInteractibleActor::SR_Interact_Implementation()
{
IsInteract = !IsInteract;
if (IsInteract)
{
InteractDelegate.Broadcast();
}
}
void AInteractibleActor::OnRep_Interact_Implementation()
{
if (IsInteract)
{
InteractDelegate.Broadcast();
}
}
Interactible Actor is calling SR_Interact BUT! It's not triggering with warning : LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor BP_InteractibleActor_3. Function SR_Interact will not be processed.
Is there any mistake...?
It's working in playercontroller but trying to seperate functionality to using actorcomponent is not working....
I think there's something I misunderstanding but I can't find out
You're calling a server function on the InteractableActor.
I'm calling it because I assume interactibleAbility called it in server side inside of SR_Interact(UInteractibleAbility)
Is this not correct..?
If the Actor is never meant to be owned, ditch any networking related to Server/Client. It should only have OnReps, and Multicasts. It'll be easier to debug. Then put a breakpoint in the component's SR_Interact. See if that breaks in gameplay. If it does not, put a break in Interact and see what your component's state is. It's owner should be PlayerController, check the netmodes, etc.
Hmm I want to say that your component should also be replicating in order to call RPC from it but Authaer said otherwise, so I'm not sure
Putting breakpoints should help us more on that, maybe your component is required to be replicated for the UInteractibleAbility::SR_Interact_Implementation to be called on the server. Maybe your argument you give to (aimed interactable actor) it isn't being replicating hence when the function executes in server it doesn't have a valid InteractibleActor to call the AInteractibleActor::Interact on it
Name stable ActorComponents don't need to be replicated to RPC, just to replicate. The RPC is sent through the actor channel and the connection can resolve the component on the other side by name even without replication if it's name stable. By default any default components in the class are name stable. Anything added at runtime needs special work to name it name stable
I grab some information about this https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Networking/Actors/RPCs/
And there's say
Requirements and Caveats
There are a few requirements that need to be met for RPCs to be completely functional:
They must be called from Actors.
The Acto...
Is that means RPC must be called from actor?
What does being name stable mean?
not working in actorcomponent?
I have a server owned actor that needs to explose ... to broadcast this explosion with particles.... is the only way Multicast?
I've already replecated components
Meaning it has the same name for the same component on the server and the client.
Object, actors can have those too
Yeah. ๐
But the TLDR is that you don't need a replicated component. It just has to be name stable on a replicated actor to RPC, as it goes through the actor's channel to do the networking.
Is this when I use something that is replicates as the argument of an RPC, how it being resolved on the other device?
And its name stable by default only if its a default subobject
Not quite
All actors from level have same nsme on all machines
All rheir defsult vomponents have a same name relstive to their actor owner
So an object csn be resolved by name over the network
But the name only gets sent once - after which its replaced by NetGUID
Ssme thing applies for asset pointers, their names are always the same in the package, same as level actors
None of those need to be replicated for you to be sble to replicate pointers to them
Replicated actors are assigned a netguid as they spawn , and are never resolved by name
Their default components have a stable name relative to owner
And as owner can be resolved, so then can the components
So this should apply to default components of both default actors in the level as well as the spawned ones since their owner can either be resolved by their names or NetGUID?
Yes
Got it, thank you very much
So coming back to this, just to be sure, the replication of a default component only matter if there are replicated variables in it?
Kinda, you have to keep in mind that there are engine base component classes as well, that sometimes replicate stuff too
like attachement replication in USceneComponent
so its not just your replicated variables
Got it, thanks again, to both of you
Ok Stuck
Guys Does Anyone Know ,Why Create Session Fails on Standalone.
Online Subsystem Eos is Enabled.
And If Possible How to fix that?
I would suggest asking in #epic-online-services , also provide some logs or something similar in there. No one can magically guess what the issue is ๐
There are No Errors in the Log
Like Simply The Create Session Fails
Is it because of Eos?
EOS doesn't have to be the issue, it could be, but in general it works just fine for a lot of people. But like I said try asking in #epic-online-services as people there know a lot more about the issues that can happen with EOS then we do in here. There's also Epic staff in there usually.
Remember also to pump those logs to Verbose or even VeryVerbose
Ok I'll try there , But I'm using the paid version, So there should be no error with Eos right?
It's the amount of logs you can get from a specific module.
https://unrealcommunity.wiki/logging-lgpidy6i
Check the different log levels here
Logging means keeping an ordered record of events, function calls, variable values at a certain time during runtime, etc. This is usually saved in the form of text in a log file.
But long story short, if you need details on why something is failing it's always a good start to figure out where that system is logging and increase the related verbosity in your settings. I think for Eos you'd start with LogOnlineSession
Ok In Session Frontend
I get this warning
LogScript: Script Msg : Create Session - Cannot Map Local Player to unique net Id
That's where you lose me, I'm not super familiar with the online subsystem. An initial guess would be that standalone doesn't support features like assigning local players a network id. Or maybe you should just trigger a login before attempting to start the session. Post this in the Eos channel and see if someone can help further!
Is it possible to connect two packaged games using the command line? I want to test something in a packaged build (to rule out some possible editor interference) and it would be quicker if I don't have to do a connection menu widget
And One More Thing Like Is It Compulsory to Make The Player Log in
Ok now the Create Session Fails Even In Play in editor
What do you mean by this?
Like Should The User Should Be Logged In?
Like Should There Be User?
And One More Thing
Should I Authorise Epic Game Account
hey devs , can someone please explain why my multicast RPC only executing on Server ?
you must login to use EOS. And you need to authorise your own project, yes
When I Click Authorise Epic Games Account
It says Oops! It looks like the Authorisation didn't start up correctly as there is no log file present .Please Contact Support
seems like something is misconfigured on the eos side of things
Step 1: Make sure you setup the tokens with full permission so that it is not a permission error
Step2: Make sure you entered the correct values in your INI files
Step3: Make sure the workflow is correct
Step4: Use EOS DevAuth
Step5: Move discussion to #epic-online-services ๐
Which actor are you adding your component to?
Is there any way to interact with a gameserver beacon from an API Backend? Like without using an UE4 client to interact with it
๐
oh well, then continue it there...i think there are more chances to have the right people see question if it's posted there rather than in a generic multiplayer channel. but, whatever works
Tokens ?
Eos DevAuth Where is that?
In the fodler somewhere. I dont have EOS on this PC
Yepp I did๐
windows explorer search for devauth
regardless
Do I still need that?
its part of EOS SDK
Oh ok
It facilitates development once you are used tot eh workflow
your IP address wont get blocked from epics server
Ok Found There's two ZIP ,
and you can easily test multiple users locally whilst only authenticating once
Oh ok
screenshot?
In Project Settings > Epic games services
Should I app;ly this compulsorily if im going to release my app on google play store
I think I'm gonna go crazy..
