#multiplayer
1 messages Β· Page 658 of 1
Even if you could, pretty sure you'd be breaking Steam's EULA
you might as well just use subsystem null and do your own connection system (or use EOS)
Hi,
I m about to implement point sharing logic for my game.
Its like kill points will be shared among all same team players if they are in specific radius.
My approach is to spawn a sphere on server with my radius and get all same team players and share points by applying GE.
I just wanted to know if there is any other famous technique for this kind of problem statement.
@rich ridge Spheres are a lot more expensive than a simple distance check.
is sphere trace also expensive if compared to distance check?
Depends on the size I suppose. Though I can't see any sphere trace being quicker than a distance check if you already have references to the team.
i think distance check is very efficient, I need to get PS array and check their distances.
Writing my first NetSerialize. It seems to be working correctly. I'm just looking for a confirmation that I'm understanding this correctly. I've basically written the following as a test, if I were to compress three integers down to four bytes, since the first integer would need two bytes of data.
bool FMyStruct::NetSerialize(FArchive& Ar, UPackageMap* Map, bool& bOutSuccess)
{
uint16 CompressedFirstInteger = 0;
uint8 CompressedSecondInteger = 0;
uint8 CompressedThirdInteger = 0;
if (Ar.IsSaving())
{
CompressedFirstInteger = StructFirstInteger;
CompressedSecondInteger = StructSecondInteger;
CompressedThirdInteger = StructThridInteger;
}
Ar << CompressedFirstInteger;
Ar << CompressedSecondInteger;
Ar << CompressedThirdInteger;
if (Ar.IsLoading)
{
StructFirstInteger = CompressedFirstInteger;
StructSecondInteger = CompressedSecondInteger;
StructThirdInteger = CompressedThirdInteger;
}
}
is there documentation somewhere regarding optimising variables in terms of networking? like the cost between FVector and the NetQuantize variants etc. and even the primitive types
I havent touched multiplayer in over a year. Need a refresher with classes and framework.
Widgets are non replicated and only owning players can see theirs.
If i want to update the widget i have to pass by the player controller.
If i want to update another player's widget, i have to first announce it to the server then the server has to tell the client to update via their player controllers and then their widgets follow.
How can i track which player controller is not mine?
u dont have to pass by the player controller, u just need to make sure what ur updating only runs on the owning client
Get Controller on Possessed Pawns
for the last one
There are no pawns.
This is a classic interface scenario.
And that makes no sense either how can you refer to someone else's widgets without passing by their player controllers? You cannot see their widgets.
would in theory there be able to make a seperate game in UE acting as a "dedicated server" and run it with a UI to controll it, which will allow full BP programability for it? aswell as then making connections happen through the client version of it?
I'd probably use Listen Server to do that and have logic for server only.
But make it a seperate UE4 project yes?
No it must be the same project, must load the same level for example.
Aaah, damn, cuz im struggling to find anywhere when researching ue4 dedicated server saving player stats etc
any good links?
I use built in savegame system to store player data on server π€·
Nothing special really, savegame file is named via the steamid, serializes player inventory etc to savegame. Written in c++
Aaah alright ok
I'm trying to understand how this part of the CharacterMovementComponent works:
The system for buffering saved moves already ensures that movement information lost in transit will be resubmitted and evaluated. This provides a similar safety net to a reliable function, but without the risk of overflowing the reliable RPC buffer, and with added provisions to make sure movement data that is too old gets discarded.
UCharacterMovementComponent::ReplicateMoveToServer appears to find the oldest (unacknowledged) important move and send it alongside NewMove whenever NewMove can no longer be delayed (here: CallServerMove(NewMove, OldMove.Get());).
Then, in UCharacterMovementComponent::CallServerMove, the old move is sent to the server using ServerMoveOld.
My question is: what happens when there are several old moves which need to be sent? What looks to be happening is that a single old move is sent right before the next new move.
I want to understand what happens when multiple consecutive moves are unacknowledged and if it is possible for there to be a chain of moves like this:
Move 1 (acked) \β Move 2 (not acked) \β Move 3 (not acked) \β Move 4 (acked)
Anyone know why this calculation would work for local client but not network clients?
the weird things is the top two gets return a good vector for both local and network clietns, but the second get + top vector returns a near origin vector, way away from my character
Which player controller?
GameState has an array of all of the player's Playerstates.
Ah, yeah I suppose it doesn't have a pointer to the Controller.
You could probably just have an array in your GameMode, and have all of your PlayerControllers register themselves at spawn or beginplay. Since it's only needed at the end of the game.
The answer is that passing a vector through a "normal" vector parameter will normalize it. I thought, well a vector is a vector, so if I know it's not a normal I can use it however I want!
No.
How can I get player controller in a world blueprint for multiplayer. Trying to set view blendspace to a different camera, and it keeps giving errors.
@gilded nest for fast effect I did that
it's in game mode
does it matter if the event is run on client or just not replicated
still doesnt work. I created an event in the game mode to do it, and then in the level, i use a interface ref, then call the event, and set the viewport through there. Still gives errors
any tutorials for this?
how do i connect 2 remote devices through network using unreal engine? any tutorials for this? all the tutorials i found are running on the same computer
advanced sessions plugin is a good one to add. You can create sessions and join sessions, through steam.
Hi! how would you go on to implement a timer like this on a dedicated server?
the timer should be so that if you log out, when you come back, the timer shows the correct time remaining
Store the timer start and end times in the server, then calculate the remaining time in the clientside before displaying it
Hi! one question on diablo 3 multiplayer arquitecture.
i think they are using a listen server when ever you make a new game.
But at the same time, they are saving into the database, how do they prevent the client side cheating like mad?.
i'm trying to avoid as much as posible using a dedicated server and i'm trying to see if a listen server would work
Can you enable component replication via c++?
Enable or disable replication.
So I'm working on replicating a physics tool. This is a simple poke feature for adding impulses using a line trace.
I'm trying to figure out how I need to replicate the client side. For larger sequences like this do I still need to send in ever single component such as the camera, object slot, and other variables all through the rpc? Or is there a much easier solution?
I was attempting to just tell the server to do it I believe my reference is wrong im using.
This is the way I got working, just by sending in ever variable and object reference needed to do the action.
I can't help feeling that there is another way. A way that doesn't require so many variables to be passed over the rpc.
I'm mostly wondering for future sake for more actions and systems.
Well this method actually didn't work either. The problem was i was sending the camera reference as a perimeter which didn't have its rotation replicated from the client. This caused the forward vector to always be in the wrong direction. The way I solved this was by sending the vector over the rpc instead.
final solution
Now i just gotta replicate a bunch of more stuff.
π©
I'm sure I'll forget how to do it at least 10 more times, but i guess that's part of the puzzle.
You can also use "GetBaseAimRotation" or whatever it was called
That should use the replicated pitch etc.
Generally speaking, you won't have a nice time with replicated physics
Either they de-sync cause Physics aren't deterministic
Or if you keep them in sync, then the Client will almost always get jitter and corrections
And if you keep the poking on the server side and only replicate the location, it is always a bit laggy for the client that starts the poking (delay for RPC to the Server and then location back to client)
Thanks for the feedback.
Yeah, honestly I think most physics things such as this could be run on the client and not the server. Any jitter would be much less of an issue if your not the player experiencing it.
idk if that even the right way of thinking about it though.
If it's not gameplay relevant you could make it client authoritive
In case that's possible for your situation
Hey guys! I have a problem.
Why is the event dispatcher not replicating?
This only works on the server.
Event Dispatchers don't replicate
The only thing you are replicating is the variable there, not sure that even makes sense
You need to call an RPC or use an OnRep and let that trigger the Delegate/Dispatcher
Anybody knows how ReplicatedUsing needs to be implemented in C++?
For example I need to set speed of my AI
anyone knows of some post or video on how to replicate turn based grid movement?
Iirc my Compendium (pinned) has an example of that
But it's basically:
UPROPERTY(ReplicatedUsing = "OnRep_Speed")
float Speed;
UFUNCTION()
float OnRep_Speed();
And then adding Speed to the GetLifetimeReplicatedProps stuff
Optionally you can do float OnRep_Speed(float OldValue), which BPs actually can't do.
Don't need that often but the option exists.
Thanks, I have another question. Would u know what could be the reason of ai wont move in 1+ play as clients buy it does in other modes. I get stuck at move to in BT.
hi guys , my question is, what's the best way to add team voice chat?
In my experience, the built in solution sucks. I integrated Vivox which has been great, but EOS now offers a free VOIP solution (the one Fortite uses) which I expect would be good.
Either solution will require integration work.
hey guys π I have a Gameplay Ability System Question:
does anybody know if or how I can use rep notifies in an ability if I replicate it?
I tried this setup, but any rep notify will only be called on the server
I would like to receive the notify on all clients
I think you should also state what you are doing with that Notify
Because I haven't needed a single RepNotify in any Ability throughout the two years on The Ascent
So chances are high that you are trying to do something that can be achieved differently
that is very well possible.
the ability should play an equip montage and then once the montage reaches a certain point, do stuff like updating the held object mesh and the animBP
PlayMontage should already be replicated afaik
And if not, you can put the OnRep into your Character or wherever your weapon pointer lives
@hazy silo
I was doing that in an "equipment component", the problem is that the ability is calling back to the component which seems not correct to me
ideally, abilities shouldn't even know about the character code, right?
Anyone got any links as to where i can learn to code on the dedicated server?
and read up on that?
Why not? I think it's totally fine that your ability tasks to your gameplay code
You need them to communicate in one way or another
For example?
Coding Multiplayer for Listen and DedicatedServer is, in its first instance, exactly the same
The only big difference is that ListenServers are also clients and have visuals, while DedicatedServers don't.
So am i able to store variables on server via bp?
or c++?
What exactly are you on about please?
Because DedicatedServer is just a headless version of the game that allows Client connections
What you are writing sounds like some database stuff
Yea, but i was hoping to avoid using that and be able to create a save using the dedicated server to fetch variables stored in the save from the server side and display it to the player 
But might aswell get into VaRest and use that
Why don't you ask about that then haha
Your question was "Learn to code on the dedi server"
well perhaps i was looking for other options
yes as in is that a possibility at all
It's always better to actually explain what you wish to know about
So you want to save player data persistently
If all you need is the data bound to that Server, then a SaveGame is enough
If you need the Data available from everywhere on multiple DedicatedServers, then you need some centralized database
okey so if im getting this correctly, SaveGame - 1 Dedicated Server? and centralized meaning VaRest plugin usage and php to sql db of sorts to generalise stats over a network?
I guess you could save SaveGames centralized too
But I doubt that scales well
And yeah, usually you build this with some Rest API
That talks to some webservice
And that webservice talks to your Database
At least as far as I know
And with that comes the usual problem of hosting that sh*t somewhere, as well as making sure it's safe from stuff like DDoS, and worse
So basicly, i can build my project's website, to have the login etc, and store the diffrent stats of a player there, and use that as REST API, i'll dod that hten
so this looks legit to you? π
Yeah, would replace the getter with an interface but sure
okay, why would you do it via interface, is it that much faster?
GetComponentByClass actually uses FindComponenetByClass, which iterates over all components of that actor
I rather use an interface
Usually all my systems have an interface to communicate between each other without knowing the actor behind it
okay π thank you very much for your help, @thin stratus π
Does anyone know if there's an event/delegate I can hook into which is called after world is loaded, but before replication starts? And allows me to delay replication until some async task is finished.
I am trying to set a mesh in a player state when a player selects their character at a select screen. It works for single player but when I do it with multiplayer listen server) the server sees all characters as the same character that they selected while the client(s) see all characters as the character that they choose. I realized that I was using something that was not replicated so i swapped to a custom player state that I made. The issue that i am seeing is that when i update the character mesh inside of the new player state that the character mesh is still empty when the level loads. Does the play state get cleared when a level is loaded? Is there a better way of setting a variable and having it stay the same from a main menu through a level loading?
PlayerState always clears, hard and SeamlessTravel
But SeamlessTravel allows you to move the data from old to new PlayerState
Via CopyProperties function in the PlayerState
SeamlessTravel only works for ServerTravels, so when a Client is already connected to a Server and the Server changes map
Connecting to a Server or Leaving a Server (disconnecting) will always be a HardTravel
@tight glen
Means a Variable set in the MainMenu will not survive the connection process
So you'd need to either let teh Server ask the Client via RPC and what class it should spawn
Or utilize some C++ to pass some FString along when connecting
Oh man thanks so much been struggling with this all yesterday
is the best/easiest way to get around this to create a lobby system so that the players join the session first and then any variables that are set are directly set/saved on the server?
Yeah that's one way
okay, maybe thats what i will try. Havent seen any good examples of the other methods you referred to and at least this way will let me make some progress
Hi! has anyone integrated firebase to your unreal project? i'm currently trying to implement it for auth and database, but i'm having trouble with the initial project setup integration (i'm okey with api calls using VArest, but i can't integrate the firebase project to my UE4)
Question - Is it possible run a dedicated server on an android device? i don't see a setting for packaging up a dedicated server on android XD.. its not that big a deal, but i kinda would like it
Is there a built-in way of preserving player controllers across SeamlessTravel when the controller class is the same across both levels? In contrast to detroying the controller in Level A and creating a new one in Level B
no
it will melt
game mode has a GetSeamlessTravelActorList method which specifies what actors should travel
also things get copied via SeamlessTravelTo/From
lol the server is a lot lighter weight than the game itself XD
as long as it is limited properly it wouldn't be impossible, but i don't want to write my own code to make the android client if its not already an available option
still it will be a separate application. i don't think you will be able to launch it
^^ that might be more of the problem
i might be forced to make it a listen server sort of garbo
online phone games usually host dedicated servers on VDS which requires investment
The dedicated server should be windows or linux, and your android client should be able to connect to it as long as code is cross platform compatible.
You can use AWS EC2 to host the server or Gamelift/PlayFab. Which cost money.
Hey Aaron, thanks. That wasn't quite the idea I had in mind, which would entail essentially a mesh network of phones hosting small server "rooms" that clients could connect to directly
its ok, i don't need to worry about that idea right now or for years lol
I've got plenty on my plate at the moment, but I wasn't sure if it was just "oh yeah, add this line to bla bla bla and it can generate a android server. Its normally a bad idea so they don't make it readily visible"
^^ i understand
i get the difference lol
dedicated would run even if the client wasn't running
but yes, some ideas I have could be accomplished with a listening server
i don't think it's unusual at all. Art of conquest and clash work on dedicated servers (i think) and they are extremelly popular.
^^ yes but i am sure those are dedicated servers running on linux/windows, not the phone itself. the Android systems connect as clients
oh yeah, for sure. i don't think anyone is running a dedicated server on the phone, the security risks would be outrageous.
Risk of clients taking user data from the phone? or you just mean the security of the Game itself?
or just the "risk" or a port being open at all?
Calling UActorComponent's Activate(bReset) function on server is enough or should we call it on local client too?
Hello there...i try following CRETE channel in Youtube regarding UE5 Multiplayer setup...but im stuck at error
E1696 : cannot open source file "OnlineSubsystem.h"
need help on it :(. or can i get any other solution to connect multiplayer? thanks in advance π
maybe you need OnlineSubsystem in your publicdependency module names in build.cs?
hmm okay i'll try have a look on it. i hope im using UE4 tutorial is fine with UE5...hehe
nice π π
hehe same with me. i just started yesterday learning how to Multiplayer. I can find lots of solution for UE4...for example using advanced session, download the code in github etc. But for UE5 Early Access, i can find the code/advance sessions. Perhaps , it isnt come out yet...ahaha
i cant find*
Man, I am struggling to get my attached actor's relative transform to update on clients. I have a flashlight attached to a gun (skeletal mesh). Everything in the docs says attached actors are replicated as long as their parent components/actors are replicated. But that just doesn't seem to be true in my case. The server looks perect but the clients don't seem to get the correct position of the flashlight once the attachment occurs on the server. What might I be doing wrong?
Donβt see a channel for game features and modular gameplay plug-in so Iβll ask this in a couple of channels
Now I was checking out the Ancient Game code and I was thinking of how adding game features like GAS abilities would work. Do you only give the abilities that the player sets he wants to use? (Use the game instance to save a βloadoutβ then load that data into your functions to add game features) or do you add all the abilities that would be possible so the player can have references to them to recognize the ability if he doesnβt have it equipped but it is used against him? Would that open a big window for cheating
Maybe that's still better placed into #gameplay-ability-system
#multiplayer feels pretty random for this topic :D
Bottom right
View Options
If the client cannot look it up themselves, it needs to be replicated. I'm fairly sure that ViewTarget stuff is all local and non networked.
Hm, I guess a ViewTarget can only exist on the Client that uses it
As long as you don't need that Camera for spectator stuff or so
Well the PlayerController has some boolean to manage the active camera target
Make sure it doesn't override that later on
Also I can not advice setting the ViewTarget to something else than the Pawn
You are asking for trouble with features like "OwnerOnlySee"
because that is based on ViewTarget
If you want to offset the view by some CameraActor, use the PlayerCameraManager and override its function that returns an updated POV.
There you can grab the ViewTarget, being your Pawn, and then grab the Camera from it and return the location and rotation of that
Then your ViewTarget remains correct
Character
Pawn is the parent of Character
The thing you are controlling
That is possessed
Well yeah, Actor is above all of those
Yep
And the Character should be the ViewTarget
At least while you are controlling the Character
I just explained you how
Yes
How do I set a Bool to True in runtine on an actor, so that when another player joins later, the bool will also be true to him.
I have an actor here that is set to replicated and the boolean variable is also set to replicated. I make sure to set it to true on server.
But when my client joins, the bool is false.
Hmmm
Theoretically you are doing it right
Is that an Actor that is placed into the level?
Yes it is.
Any chance that the Blueprint itself has the boolean set to true, and the instance in the level has it set to false?
Because there is a bug where it compares the boolean state to the Archetype (which is the BP Class) and that is true, so it doesn't cause the replication.
The bool is set to false on the default class and the placed actor
Me neither. I don't understand why it's not working :/
This comes out as false when the client joins later on.
when using Switch Has Authority, it's the same outcome.
because by the time you do the print out, the boolean haven't replicated yet?
I made it work by giving it a small delay. Apparently the client doesn't have replicated variables set accurately immediately. But adding a tiny delay, gives them the correct value.
imo, using repnotify would be better than giving it a small delay
Delays are not a good solution though
is there a good way to do a delay?
what if I have a long load time and my tiny delay doesn't come through?
Delays are never the solution to anything
What would you suggest I do then?
I guess I could have the loaded in palyer call for it?
When it comes to multiplayer you have to accept that you will never have accurate and predictable timings for anything
You need to either be able to change that boolean dynamically, or you need to build a system to ensure you did indeed get the correct value
For example you can turn that bool into an enum : uninitialized, false, true
Default to uninitialized, if you have false or true it's certain to be a replicated value
And then you'd wait for a repnotify, or on tick, for that value to be set, and at that point you can process it
Personally I also keep the loading screen up until I know the player has a valid state from the server
Multiplayer is 5x more work, case in point
Yup completely agree
So I'm working on a random name tag system and struggling to get rep notify to work correctly
Currently things replicate correctly with the correct name, but not updated when needed.
before the names are set using the server RPC I have to give a really big delay of 3-5 seconds, otherwise players spawning in after another player wont get updated. (Any players who see one spawn will see their name.
When hooking up a key event to call the sequence again this always replicates correctly, however at any moment if the player becomes not relevant their names are gone when becoming relevant again.
I figure its definitely an issue with the rep notify, but Someone with more experience with replication could probably see what I don't.
I just realized my cast is failing in the rep notify
A) Use an FString not FText for the replicated property
B) You don't need a multicast, the property is replicated - just set it on the server.
thanks, will give it a try.
Changing it to server only prevented clients from seeing names and calling the sequence again while relevant didn't update names.
After going back to multi cast and looking at the Rep Notify function I'm not sure what is happening to make the cast fail only part of the time.
BTW, my nametag widget is just using a binding to its own non replicated variable. Since I'm setting that variable with the rpc in the player that shouldn't be the issue.
Multicasting to set a replicated property makes no sense, the property is already replicated - it will already be sent to clients.
The cast could easily be failing because of a race condition.
What happens if the property replicates, but the widget doesn't exist yet, for e.g.
If you're just using a binding in the Widget. It'd likely be easier to just pass the character into the widget, and get it's replicated value to display instead.
So without a repNotify?
Well. The notify would be better, along with a set on Beginplay. Event Driven. But if you're using a binding, there's not really a point to the Notify.
Tick the widget would be better than a binding and would get around the race condition
Otherwise, setting it both from a rep notify and also checking when the widget is first created would help.
are you talking about setting the widget text on tick rather than a binding?
do i need to activate servertravel for the level i created?
this is not working for some reason
If at all SeamlessTravel and that is not supported in the editor
Im using standalone @thin stratus
it just keeps loading forever
cant even get a log saying why its not working
And you are using ServerTravel to move between levels as the Server, right?
It works perfectly on a level i migrated from another project
Maybe the paths are wrong?
I usually just write the level name with the /Game/ part
arena 1,2,3 dont work and BomberMap does
GameMode set on the maps correctly?
Well, i guess the issue with the cast on the RepNotify was the widget was being destroyed. At least I'm mostly sure that's what it is. I was thinking for a second that the repNotify could be called before the widget is constructed. Not sure how i could test that though being i cant use delays within it.
So Im just not giving it the correct widget until the rep is called, then creating one.
Yea that was it, thank you. i thought about it but i assumed it would just spawn me in the sky without a gamemode override
Is there a way to check if a pawn is controlled by the listen server, in blueprints?
So if its a client?
Depends from where
Say from the listen server, can I check if a specific pawn is currently controlled by the server?
Wouldn't that be the same as using a Has authority?
Locally controlled will return true on autonomous proxies too though
No, not at all
Every single actor on the server will return true to HasAuthority
Autonomous proxy means remote player, so IsLocallyControlled will return true on clients, but never on the server
I did say it depends on where you're checking
Remote clients will likely require a "is server" bool replicated from the server's IsLocallyControlled
Hi! how would you go about setting up this feature of swapping between city mode and explore mode?
https://www.youtube.com/watch?v=v4klOqxePHA (15:55 - 16:05)
keeping in mind that on the explore mode, the pawns are replicated and you can see other's people pawn walking around in the map.
So far i'm thinking on use one persistant level for the City and when going into explore mode, use a streamed level for the map exploration (or maybe the other way around).
#artofConquest #mobilegame #gameplay #moba #strategicGame
Hi...i manage to connect between 2 pc, using advanced session plugins. The problem is, one pc Host is fine...the character loaded good and can move. But the 2nd PC join the host, it doesnt have a Character....just fly mode. Why is that? Thank you
Hey guys, a dumb question here.
How do i replicate this thing? It does work for the client (i.e the client can see the player moving its head up and down, but if the server moves its head up and down, there is no output in the client screen.)
I am using modify transform bone instead of an aim offset
Can we use OnlineSubsytemSteam with default IpNetDriver?
Are you using Input Action to execute this logic?
OnRep functions are not called in standalone right?
They arenβt called on the server in c++
Should be called in bp though
I would move to replicating camera pitch range
My OnRep is a BlueprintImplementableEvent and it isn't being called on standalone
Just call it manually
Then setting the rotation of the camera based on the pitch range if the actor is not locally controlled
quick question: How does the server & clients handle other characters' camera components when they are in a replicating character?
I usually do my camera components local only but I got my hands on a project that has them as a default character component
Any idea why an overlap event might be generated on the server but not the client?
I am walking my player character into a volume but only the server generates the overlap event
Hi Guys!!! I hope you are getting a great day.
Maybe someone have had this issue with a dedicated server in Linux??
When the player chooses the server enter but is kick out immediately.
the Client is for Windows and Server for Linux (running in a gcp vm instance). both built with the same engile, I've deleted intermediate saved and derivateddatacache but the problem is persistent, with a windos server works fine the problem is linux build.
NOTE: the mismatch only happens with characters, we are using GAS for a lot of things
[2021.08.18-04.28.56:227][576]LogNet: NetworkFailure: NetChecksumMismatch, Error: 'GetObjectFromNetGUID: Network checksum mismatch. FullNetGUIDPath: [19]/Game/Characters/Klowns/KlownKlasses/Brawler/BP_BrawlerKlown.[17]Default__BP_BrawlerKlown_C, 2259927734, 2943822821'
is it possible to private message someone here on how to implement spawn protection?
my question on the other chat got ignored
did you try to use the searchbox? sometimes there are solutions that other users post before
i just searched, there's not other query about spawn protection
i've been following a tutorial on making a fps multiplayer game but there's no tutorial showing how to do spawn protection
What does "spawn protection" even mean here ?
As in CoD where you can't instantly get killed after you spawn ?
I guess it shouldn't take more than 1 boolean "bCanBeDamaged", a check if it's true or not in your TakeDamage method and a timer which will reset it after the set time is passed
problem is i know like the "method" of how it works, it's implementing it is my problem
can i send screenshots here on how the respawning works?
Screenshots are like always bad.
You could just send the important part here or just the whole file since discord supports it now pretty good
Totally forgot about BP's xD
this is the events for damaging players. I have an == enum where if you're on the same team as someone, then no damage is applied. I want to do that but in a delay after spawning
The first thing i'd check is the boolean if it can be damaged or not
i'm lost
You need a way in your AnyDamage method to know if the character is still under spawn protection.
The way you could do that is with a simple boolean
i thought i had to implement the protection as the player spawns..no?
So it's really nothing more than
if(bHasSpawnProtection)
{
//Do nothing
}
else
{
//The rest of your current code
}
Well yes, but that's just 1 part
Doing this check in your AnyDamage method is another step
i understand
okay i created the boolean variable
replicated
So now you should basically add this here to your AnyDamage method ^
im assuming like this? If IsSpawnProtected is true, do nothing, else do rest of the method?
Yeah
okay cool cool, that's some progress
Also, just since it's easier you should set the default value of IsSpawnProtected to true
i think that's what the bp does, the false bit is ... false lol
Normally it should be false by default, so better check that
im looking at all the other booleans and it's similar in how the screenshot i sent is. since im getting the variable
It is false by default tho
So now in your begin play you need to create a timer which will set it to false again after the passed time
It should also have an authority check i think
Apologies for the ugly nodes but like this?
Ye
do i have IsSpawnProtected set to false or true?
Should be true by default and you set it to false after the delay
No problem.
Note that i have currently no idea if you really need the authority guard here nor if the boolean has to be replicated xD
haha, yeah everything seems to be working
to think it was that simple yet i struggled so much π
Can relate xD
Dw, happy if i can give some help back after getting much help from the server :P
thanks man π
Is there a discord channel for Vivox questions?
How can I replicate a variable on the PlayerCameraManager? I did the standard UPROPERTY replicated flag, but the client is not receiving the updated variable from the server
bReplicates = true as well, so not sure why
Does PlayerCameraManager [systematically] replicate at all though?
it gets created on either APlayerController::PostInitializeComponents() and APlayerController::PostSeamlessTravel()
it says // servers and owning clients get cameras , but it spawns the managers locally.
and if you take a look inside APlayerCameraManager, it doesn't look like the actor was set up to be replicated
so I don't think you can
the pointer inside Player Controller doesn't replicate either ```cpp
/** Camera manager associated with this Player Controller. */
UPROPERTY(BlueprintReadOnly, Category=PlayerController)
APlayerCameraManager* PlayerCameraManager;```
@blazing socket
is there anyway I can create a multiplayer session using advanced sessions without having each user needing to portforward?
i'm trying to setup a pary system. I use AWS for actual game sessions but want to see if I can have parties on steam servers with advanced sessions. but the issue is that for anyone to host a party, they would need to port forward
^ idk if you can without it. if you're using SteamSockets you don't need to port forward though
however, idk if Advanced sessions can actually use SteamSockets functionality
hmm ok how would I use these steamsockets?
are they used for dedicated or listen servers or both?
It's not pretty. Your easiest way out is to purchase a marketplace plugin that supports it
they can be used for both
yeah i probably would just buy a plugin
I saw steamcore
seems like it might be what i need
using that plugin for a personal project myself; it's enough for that project's needs 
and that can use the steamsockets?
yes; it still requires a decent amount of setup, but significantly less than if you're implementing it yourself
yeah i bet
then again, that's less of a pita than implementing port forwarding
with this steam core, is it able to setup dedicated servers on command? I'm using AWS for my servers, but they cost a lot since I'm doing many different regions
wondering if maybe I should switch to steam servers
Steam doesn't actually house game servers. There's a decent amount of reading that you have to do for both Steam side, UE4's impl side, and SteamCore's (if you go that way) side
ok forsure ty for the info. I will look into the plugin.
do you have any experience with the party/beacon system for steamcore? @dull lance
My project just uses Lobbies for the intermediate process. For my purposes, it's enough.
I haven't really used Beacons just yet.
ok thanks a bunch for the info I think you've put me onto the right track for getting what I need done π
Ah shit gotcha. What's a workaround? I could have the client tell their own camera manager to change its speed but afaik you don't want to allow clients to modify those things
Usually you replicate this info either in the Player controller or the Pawn [maaaaybe even player state], depending on needs
Hey there. I Hope everyone is having a great week!
How ever I've gotten a bit stuck. I'm a newbie with UE and especially the networking side. I'm trying to replicate the players looking rotation animation(aka. have the third-person character that the rest of the players can see, look where the gun is pointing). This works in single player by modifying a spine bone in the Anim Graph.
How ever when i try to replicate this it just applies the same rotation that the local client is using on the rest of the players. There is probably something that I'm doing wrong and just me being a big dum dum so i thought i'd ask the UE wizards on here for some help.
Have a good one! π
there are so many rules being broken here
Begin play
it's not available in the editor
Is there anyway to check if it has online subsystem then?
i want to check if steam online subsystem is working
with the has online subsystem node
Steam is disabled in the editor, use the standalone game instead or package a build
Not launching the editor with the -game command line switch? What engine version are you on
Which method is usually used in multiplayer games for modular characters & replicating equipment?
Set Master Pose Component, Copy Pose from Mesh, or Skeletal Mesh Merge?
Anyone know why epic is doing this? Channels is an array of NULL values not nullptrs, this check always fails.
NULL == nullptr
Stick to nullptr when possible
so why is this check failing? Channels[ChIndex] is 1, which is NULL value
ChIndex is 1*
and Channels contains 32k empty slots
Guys anyone know why this cast might be failing?
that have a null value
If i use Get display name it outputs BP_PlayerCharacter1 instead
NULL = 0
yes and nullptr is prvalue of type nullptr_t so either epic fucked up and is attempting to compare 0 with prvalue of type nullptr_t or I'm losing my mind
Does it actually fail?
Seems like it's indeed checking if the channel is empty aka NULL / nullptr from what you described
Most likely something went very wrong and that is the reason it is crashing. The code looks fine to me.
Check the log
yes its crashing both my client and server
[2021.08.24-16.35.32:948][237]LogOutputDevice: Warning:
Script Stack (0 frames):
[2021.08.24-16.35.32:950][237]LogWindows: Windows GetLastError: The operation completed successfully. (0)
[2021.08.24-16.35.34:119][237]LogWindows: Error: === Critical error: ===
[2021.08.24-16.35.34:124][237]LogWindows: Error:
[2021.08.24-16.35.34:147][237]LogWindows: Error: Assertion failed: Channels[ChIndex] == nullptr [File:E:/workspace/Unreal Engine/Engine/Source/Runtime/Engine/Private/NetConnection.cpp] [Line: 3272]
[2021.08.24-16.35.34:151][237]LogWindows: Error:
[2021.08.24-16.35.34:155][237]LogWindows: Error:
[2021.08.24-16.35.34:158][237]LogWindows: Error:
[2021.08.24-16.35.34:186][237]LogWindows: Error: [Callstack] 0x00007ff621eee9fa RustRacersServer.exe!UNetConnection::CreateChannelByName() [E:\workspace\Unreal Engine\Engine\Source\Runtime\Engine\Private\NetConnection.cpp:3272]
[2021.08.24-16.35.34:217][237]LogWindows: Error: [Callstack] 0x00007ff621f43ad9 RustRacersServer.exe!UNetDriver::AddClientConnection() [E:\workspace\Unreal Engine\Engine\Source\Runtime\Engine\Private\NetDriver.cpp:5272]
and attaching the debugger shows me that Channels contains 32k items of value NULL
the index its attempting to access is 1
which is valid
but the value is NULL, which should be fine right, its checking that there's nothing in this channel already
so the check should pass
but instead its asserting and crashing
it shouldn't pass if there is NULL or nullptr inside. It's literally doing what the comment above the code is saying
// Make sure channel is valid.
check(Channels.IsValidIndex(ChIndex));
check(Channels[ChIndex] == nullptr);
// Create channel.
UChannel* Channel = Driver->GetOrCreateChannelByName(ChName);
check(Channel);
Channel->Init( this, ChIndex, CreateFlags );
Channels[ChIndex] = Channel;
OpenChannels.Add(Channel);
oh wait a second
it's the other way around
I see
It's checking so that the channel isnt already occupied by something
but the sanity check is failing
because NULL != nullptr
it should be equal. You might looking at wrong channel
not according to the debugger im attaching
Iirc nullptr doesn't really point to 0 as NULL does
So it's probably trying to compare NULL 0 with something else
Only one way to find out really
putting a breakpoint on it shows me that Channels is an array of NULL so yeah either there's a #define NULL 0 somewhere
or I'm losing my mind
this is on a dedicated server in UE5 built from source
but the weird thing is that it happens on the client too
You can try changing nullptr to NULL and see what happens
nullptr == NULL
NULL is defined as 0 and is promoted to pointer type in that comparison and then equals to nullptr
UE5 okay I am out π
I dont wanna recompile the engine for that change x)
Yeah, still doesn't hurt trying to get it out of the way :p
takes like 3 days with debug symbols and all targets
Yikes, 3 days? π¬
this is getting cplusplusy xD
it's driving me nuts
Hey guys, I'm testing out a few things by modifying the UniqueId on my PreLogin() by doing this
{
const FString& Value = UGameplayStatics::ParseOption(Options, "Something");
Super::PreLogin(Options, Address, FUniqueNetIdString(Value), ErrorMessage);
}```
I get "use of undeclared identifier 'FUniqueNetIdString'". I thought I could fix it by including OnlineSubsystemTypes.h, but it's also giving me errors to find the file.
Does anyone know what is the mistake here? I appreciate any help.
Out of interest why change that at all?
You can see that PreLogin takes an FUniqueNetIdRepl anyway, which is not the same type as FUniqueNetIdString so it's not going to work
Unless there's a lot of implicit conversion going on there
You shouldn't really be changing it at all, makes no sense to mess with that really
so I guess nobody is working on cross-platform multiplayer games with dedicated servers in UE5 yet because I'm quite clueless what we could be doing that would cause this
It's UE5, literally anything could happen
Probably not wise to be building something that complex in an unfinished toolset
Might have better luck in #ue5-general - most of us are still working in UE4 AFAIK.
yes and no
we have no release date set yet and in 4.26 chaos vehicles are beyond broken, all the 4.26 vehicle crashes are fixed in 5
and regressing further back to use physx vehicles isn't an option since we've built an extensive framework on top of chaos vehicles already 
The exact same code is in UE 4.26 and 4.27
migrated to 5 the moment it was on github and so far we haven't had a single problem we couldn't fix, this is the first real blocker we've ran into in 5
you shouldn't be using a preview version in the first place ...
by the time the game is done 5 will be out of EA
not really because in the stable 4.XX versions chaos vehicles are bugged to shit :p
chaos physics is mega jank in 4
Chaos in general is bugged to hell. Not even worth using in 5 atm.
it's a lot more stable in 5 and manually merging those fixes is waste of resources π
Just worth remembering you're building on top of totally unproven tech atm, I wouldn't expect a huge amount of assistance with core engine issues in this channel if it's UE5.
Thought UE5 had Chaos on by default, huh
Bound to be massive stability problems for the forseeable future. 4.0 wasn't particularly stable - the rocket beta considerably less so
it does and physx is getting deprecated in 5
It does, but that doesn't mean it isn't rubbish.
Has a long way to go before it can touch PhysX
Oh π
someone gotta take one for the team and suffer through all the jank so the next batch of people gets into it, it'll be a lot less painful π
Is the Water any different in UE5 vs UE4? Just quick question
Haven't touched the water system since 4.26 and back then it was so janky I decided to not bother with it for a while π
Yeah, that's why, really breaks when you dare to move it away from Z 0
Was just wondering
lets just say I couldn't quite get it working π
I wonder if this is related to that check failing
Error: Channel name is defined multiple times: Control
Error: Channel static index is already in use: Control 0
Not sure how multiple net channel definitions are sneaking through though because BaseEngine.ini is clearing the array before assigning the values
I have a question concerning Hit-Events in server-based multiplayer: If a player collides with (hits) another player, do both clients fire hit-events for both players? Meaning if they call a server-side function in the hit-event, does it get called twice on the server for each player?
When I test my level, is there a way to make the clients join later? Like a 10 sec delay. I'm testing some Rep Notify stuff
you can use launch seperate server
then join in later on via command line
open "LocalIP:17777"
ahh nice ty!
how come its refering to my main menu when I tested from the level i wanted?
Collision events are handled independently by each instance, there's no networking involved.
And remember only the owning client can call Server RPC's
so if two players collide and i call a server function on hit, it will only get called once by each client for their respective players?
The point is that you don't really call RPCs for this stuff
It happens one everyone. You just have to filter
When two Player Characters collide, it will call the Hit event on literally everyone involved + server
So you can filter the Hit call by Authority/Server
ah, i completely forgot about authority, thanks
If you want it to call locally
Only for the specific client
Then you can check if the Character is LocallyControlled
And only then execute your code
But it all doesn't need any RPCs, cause on every PC, these two run into each other
Even a third player will see them bash heads
And the simulated versions will call the hit
that's a good point. i have to reevaluate what it is exactly i'm trying to do. thank you all a lot π
Aight so I figured out the damn crash, just incase anyone else ever runs into ```
Assertion failed: Channels[ChIndex] == nullptr [File:E:/workspace/Unreal Engine/Engine/Source/Runtime/Engine/Private/NetConnection.cpp] [Line: 3272]
There was a duplicated DefaultEngine.ini that contained several definitions of the netchannels, these were overlapping and the engine crashes as a result. Solution was to delete the Saved folder and get rid of all the cached bullshit.
im struggling a bit with replication graph - is there a function i can overload to add a distance check between the PC's pawn and the actor up for replication for example? i can see theres a net cull check but this is done in between the larger serverreplicate function, which overloading doesnt really seem to work because of all the private members it refers back to/cross dependant variables... am i approaching this the wrong way or is there something obvious im missing? the alternative i guess would be overloading how gridcell get actor works or maybe something else? its got to the point that im thinking about just editing the inbuilt plugin directly out of frustration! any help/thoughts would be really appreciated thanks
@twin juniper Not entirely sure what you're asking, what's the end-goal?
@chrome bay end goal is to not replicate the actor to a player if the actor is not within range or hasnt got vision of the player's pawn
(i was just going to use netcull but it doesnt make sense as thats about the actor itself replicating, whereas this is querying a vision range in respect of a pawn)
Replication Graph doesn't really support things like that.
You don't selectively cull actors, instead you determine what is relevant to a given connection by putting it into various nodes.
If you want an actor to only be relevant when the player is looking at it, you probably need to put it into a custom per-connection LOS node, and not route it to any other nodes.
Unless you have an enormous number of replicated actors, repgraph isn't worth it - just use the regular replication system and you can control relevancy per-actor / with more granularity.
I wonder if all that node stuff could be nicely visualized in the editor somehow
@chrome bay thanks i was trying NOT to do that because i was worried adding/removing to nodes was bad performance wise (but i guess this is basically what grid spatialization does)
You only add nodes at startup time or when a new connection is created, you generally don't add/remove them at runtime
(i meant adding/removing actors to a node)
(although i think grid just queries to create the list iirc?)
anyone got experience with replicating Uobjects? followed this guide https://jambax.co.uk/replicating-uobjects/ which works fine. BUT if I create a Blueprint child I cant get my head around replicating/syncing that object. Its variables replicate fine but I dont know how to reference the actual UObject. any ideas?
Same with actors, you add them to the node once, and remove them when they are destroyed usually
@plucky prairie How do you mean reference the UObject?
It's just like any other object
sorry for replication i mean
The third snippet shows how to keep a reference to the objects themselves, if you wanted to
E.g:
UMyAwesomeObject* MyObject;
UPROPERTY(Replicated, BlueprintReadWrite, Category = "My Object")
TArray<UMyAwesomeObject*> ArrayOfMyObject;```
Treat them like components, it's near enough the same thing
this is where i get stuck then unless i misunderstood - I can add a Uproperty in there but its class is BP_UMyawesomeObject (for example) which isnt in c++
so i dont quite get how i can get it to replicate
tried TSubobject stuff too but no luck
Yeah you can't do that, you can't use BP classes in C++
You would have to spawn the object via NewObject<>, and pass in a Blueprint Class
But the C++ pointer will be to whatever the C++ base class is
E.g, look at the bottom snippet:
UInventorySlot* NewSlot = NewObject<UInventorySlot>(lOwner, SlotClass);
UInventorySlot in this case is one of those replicated UObjects
ah ok so it would give me an object of 'slotClass'
and not UInvnetorySlot
correct?
Is there ANY way to be able to get my game up and running on a multiplayer server without paying too much, that doesn't need accounts?
Probably too much to ask, but i want the device to be the account, and not using any external accounts, like a mobile game
There's a lot more than one way to have multiplayer
If you're on PC on console you'd just use listen servers
@plucky prairie yeah
On mobile, you'll need some kind of dedicated server, but it doesn't have to be an UE4 dedi - you could have your entire game run somewhat asynchronously with a Web server and HTTP requests, if it's a slower type of game
of course you'd then not have any UE4 replication at all but hey
Well, i have been trying to use the free version of EOS, and using advanced sessions and such
but i want a player to just be able to host a lobby and have another player join, without accounts
Those are for sessions, they are unrelated to hosting
that's the thing though, i dunno how to do the hosting, i keep thinking i have EOS set up and then i run the game and i can't create the session
EOS and Steam are unrelated entirely
Those do matchmaking
The hosting method is completely disconnected from that
"matchmaking without accounts" and "free game hosting" are two very different topics
Oh, hm, so, if i wanted to host sessions with no accounts, i should use dedicated servers is what you're saying? I apologize for my incompetence i'm very new to this
I just said that sessions and dedicated servers are fundamentally different topics
They are unrelated
You have a "sessions" technology and a "multiplayer gameplay" technology
There is no relation at all between both
EOS & Steam do absolutely no server hosting for gameplay
The general tech stack for dedicated servers on PC is "buy a lot of Amazon servers and run your UE4 dedis" + "have the dedi create a Steam session that players can find"
But if you do listen servers the Steam part can be exactly the same
So pick your gameplay architecture first - dedi vs listen vs not an UE4 server
And then pick your sessions architecture - Steam vs EOS vs GOG vs PSN vs your own tech vs IP addresses
(And if you do your own sessions tech, that can credibly run on a free Web server for the foreseeable future - that's not even VPS territory for most indies)
Does anyone know of any code examples of pawns with physics being replicated? It would help out a ton
is it possible to start a game with out player start and just use the character bp
thanks for your thoughts - i put together a system similar to 2dgrid (by splitting the world up into sections) + LOS checking on a custom engine because range checking against all actors was too expensive - ill try and spend more time on repgraph because i think its better than the alternative unless you think its a completely wasted endeavour and simply not really possible with the way its set up
@rose raft For like ragdolls?
Like rigidbodies, for example a box collider rolling down a ramp
Or another example could be a simplified vehicle which uses only a collider
I've gotten this to work quite well, the problem for me now is optimizing it as I'm sending moves from autonomous proxies every tick via reliable rpcs, as well as the issue with physics being simulated at different timesteps
So I was curious to possibly see how others have tackled this
I feel like the only way to do that semi reliably is to more or less replicate a struct of location/rotation/angular velocity/linear velocity. If you replicate that a few times a second and let client's locally simulate the rest, it might be gentle enough on the network and still relatively reliable. At least that's how I've personally managed to get decent physics simulating components to go well enough. For skeletal meshes it'd be pretty much the same except that you'd need to replicate those values for some main bones in the mesh.
Thanks, I'll definitely give that a try
Would it be possible to manually resimulate physics?
If the client sends a move --(100ms passes)--> Server simulates it and sends the client its state --(another 100ms passes)--> Client recieves the server state and makes a correction
Then for it to not rubberband, I need to resimulate the 200ms of moves that the server did not know about, or otherwise the position will be sent back 200ms
The problem is that since I'm resimulating a bunch of moves that occured since the correction in one frame, a lot of physics simulation is lost because it is separate from my movement logic
The solution I need is when I simulate an individual move, I need to also simulate physics on the pawn for the delta time of that move
I can clarify if what I'm saying doesn't make sense
That was one reason I did what I did when I was testing. It didn't matter if your server sends the correct data and you let it be authority. Server is the real state. So when it sends data, client should sync up as best it can. You can smooth some of that out with interpolation math if you want, but the frames in between updates are nothing but visual candy for the client. Which is the reason I was sending all four of those states. They keep client best in sync with the server even if client is only getting an update every 300 ms.
Anyone have any alternatives to the server browser? Iβd really like to have a queue system where you just hit find game and it auto searches based on any available server
Right, makes sense. I think the problem is that I'm trying to predict the server so that the client is responsive. When the server state makes it back to the client what I'm trying to do is make it sync up as closely as possible. However because I am simulating ahead of the server on the autonomous proxy, what happens is when the server state reaches the autonomous proxy, I apply the server state (location/rotation/linear velocity/angular velocity) and then re-apply all movement that happened since the server state (so that the client, which is predicting ahead of the server, does not roll back, say 200ms from my last example). The problem is that I re-apply that movement, but I don't know how to apply physics for the duration of those re-simulated movements.
Sorry for the long explanation
To give an example, imagine a player moving a box collider forwards off of a cliff. When the player is falling, the client receives an update of the server state. However, that server state is outdated because of packet lag. So, what happens is the client rolls back to that server state, but then has to reapply the moving forward and falling that has happened since the "time" of the server state. The problem is that although I am resimulating the player continuing to move forward, I am not re-simulating it falling (and anything else physics related that happened), and what happens is the client has a major rubberband upwards.
Hello π
So if a widget holds a reference of an actor, and the actor is replicated, is it possible to call a server RPC from the widget? I'm trying but it isn't getting called from clients
Not possible from widget
how do i replicate velocity of my characters mesh cuz right now when the player mesh rag dolls on the client will have velocity like if im moving forward and die the charters body gets launched forward but for other players it just drops straight down
How do I set the view target with blend in multiplayer with a camera that is in a level?
So I want to work on a project where players can join a server and play together but I am a bit lost on where to start. Can I build a multiplayer game and then add things like server browsing later or do I need to do that first? I understand how to replicate and things like that but I am struggling to understand how to setup actual servers for multiplayer
why wont my charater mesh components velocity work in multiplayer like even if i set the velocity of the component from the server to all clients it still has zero velocity
#online-subsystems exists for that exact purpose. To answer you generally, yes you'll likely want to use an online subsystem in order to find your servers. It's up to you on where to host your servers if using dedicated servers. If using listen servers, then it's less cost for you server wise, but more cost for anticheat as you basically hand your clients the keys.
yeah I was kind of looking into dedicated servers but thanks for the info, I have been seeing stuff about online subsystems but I am very new to multiplayer
It looks a lot more complicated than it is
Hey, I am trying to find a good solution for melee collision in a multiplayer game, at the moment I am calling BoxTraceMultiForObjects on tick to get the hits but I am not getting enough traces, is BoxTraceMultiForObjects so bad? here's what I mean https://youtu.be/vpVEpHDFG-o
why dose the rag doll have no velocity for other players like even
iirc Ragdolling isn't replicated. So the server would stop updating the other player's velocity as you stop ragdolling disables movement input
each client see's their own version of ragdolling
you can get around it a bit
by checking their velocity prior to the ragdoll and then applying an impulse to the character as they ragdoll
to fake the funk so to speak
So, does anyone know where is the code that decide when a property is to be replicated? I am trying to replicate an UObject but somehow unable to do so, it works when reassigning the property but not when changing it
A workaround for ragdoll replication is tearing off the movement component and replicating a bones world location from server to clients
Bad, ugly, probably broken sometimes but gonna work for simple actions
what are some methods i could use to make the clients movement to other players as smooth as possible
I don't know if this is the right answer, someone please correct me if I'm wrong [I have spent the past 6 days just watching UE4 tutorials, guides, etc]
I believe you need to create a separate function (one that mimics how they normally move) that only runs server side and replicates to all clients. For example if you wanted to set the walk speed of your actor (for sprinting) you would make a function called "start sprinting", make it server side, and set it to replicate to all clients. Then after it calls that function, you would put the exact same code on that side too. That way both the client and the server are in sync (since this way the server and the client wont be fighting about the actors current position, and overwriting each other).
Again probably wrong, and probably not the answer you were looking for, but I can try lmao.
Anyhow on to my question
I plan to make a FPS multiplayer game (at least a prototype right now). So my general understanding are that there are client side listen servers (peer to peer essentially) and dedicated servers (ones that typically don't have someone playing on them and instead have all the clients connect to that one.)
**If I wanted to implement a party and lobby queue system, how could I achieve this?**My initial idea was to have each client start a listen server (as the main menu) and integrate (in the future) steam to have them connect to the party leaders listen server, who in turn could queue for a match sending all clients connected to the listen server to a dedicated one (don't know how I would make a search system for a dedicated server but I'll figure it out)
But then I realized: what happens after the dedicated server finishes the match and sends everyone back to their servers. I'm assuming I could log which people are in a party together (and subsequently who is the host of the party) so they could all connect back to the listen server, but then I realized, what if the players disconnect before the host does? On most games it would send them back to the lobby (as you would expect) but what server would the connect to? The listen server is (presumably) gone. So if the dedicated server were to send lets say party member B back to the lobby, which they do not own, then how could the connect to a lobby that doesn't exist? I get the idea that I could have the host disconnect, setup the listen server, and have the party members reconnect to it, but that doesn't seem like a good idea.
I guess what I'm trying to ask is if its possible to have a listen server be up in the background while the client joins a dedicated server. That way people could reconnect to the lobby they were already apart of, and it wouldn't have to reload them into it.
Also I have 6 days of ~~"experience"~~contact with UE4. Sorry for the essay.
That's indeed not interly correct. :p
Really really smooth requires you to inherit from the CharacterMovementComponent (CMC) and implement player movement the same way they do. There are some smaller wiki/blog tutorials out there. Generally a very tricky thing to do if the movement is more complex
You are kinda correct here. You wouldn't do the Party Lobby with a ListenServer though. There is something called Beacons which offer a light weight connection. Users don't need to activaly travel to the beacon hosts map and yet the system still offers replication similar to normal connections. That is usually enough to share data about the players as well as telling players where to connect to.
The problem of the Party host being "gone" after a match persists.
Usually when using online subsystems like steam, the session ids are bound to the player ids. So you could save the beacon session you were connected to and try reconnecting after a match.
The host on the other hand would open up the party session again as soon as they can
Clients basically need to have some simple timeout logic
Could I potentially have the clients say "waiting for host" and then once the host reboots up the beacon they would reconnect
Yeah
wait
In a perfect world you could have both sessions up at once
But steam only allows one at a time
so is beacon peer to peer? or is it peer to peer to peer to peer.
Is it a place where I could store data, (like whos in the lobby etc) and send it to each client, to interpret, and then put up on their own lobby
Because if I could do that then it wouldn't be an issue
I could just give the owner a boolean value (if able to queue), have it so when someone joins a party its set to false (but the owner still keeps it) and have the clients render each person being next to them (even though they arent actually there)
There is also the option of handling all of this with some outside third party system. But no idea if there is one and what it takes to get that running
Beacons also require c++
meaning if they left the dedicated server to go back to the menu, they would have the inability to queue, but would still have the data cached from their party members
Ack
Anything more complex in ue4s multiplayer needs c++
I know a little python so this is gonna be exactly as hard as if I didn't.
Do you have any resources I could use? (On beacons) (not on CPP lmao)
or any resources you would suggest rather
#online-subsystems should have pinned messages from a user who tried around with them
That's also the channel to further discuss stuff like that
#multiplayer is more about the more gameplay related stuff
also is this C++ or blueprint only, from the documentation it looks blueprint friendly but still dont know for sure
C++
Again multiplayer is very c++ heavy
You could say roughly 10% or so are available to Blueprints. if at all
I am very happy right now that I can use both C++ and blueprints in the same project
because otherwise this would be a nightmare. Thanks for the lead! I'm going to probably poke my head around here more cause this was really helpful.
My honest opinion and suggestion to everyone who wants to make a (multiplayer) game and become a programmer with ue4 is to make it their priority to learn c++.
Blueprints are cool and can do a lot but in the end you'll be much happier if you can utilize cpp
If I'm being honest I spent 9 hours learning python for a simple at home project for myself. I also spent a lot of time on pseudo code based programming over the past like 4 years lmao (hence my appreciation for python being easy to understand)
I also have a few friends who I'm trying to drag around on my ridiculous jump into an unknown engine and a notoriously complicated language (from my perspective) so when I said, "well yeah its possible to use blueprints for like majority of it" they literally rejoiced lmao.
That being said I'm the only one learning UE4 sooo hahajonathan.
but yeah thanks for the answers.
My question now is should I worry about networking after I make the game or before I make the game? (My friends are working on models in blender rn as I'm typing this) So should I make the game to some capacity, and then spend a week or two trying to make it multiplayer? Or should I start with it being multiplayer and then make the game afterwards. (seeing as UE4 makes it easy to load gamemodes and maps, I could just use the built in multiplayer (fake multiplayer) ) to test replication etc.
Is it something I could tediously go back through the code of, turn on replication, move functions and debug until it works properly on multiplayer?
Because I would (personally) rather make something first before spending the time to learn C++ and then networking entirely, although my initial thought was to make it multiplayer from the start so it would be easier to make. (Also I found someone who ported beacons to BP, but its 15$ and I feel like I should just learn it myself instead lmao)
Anyhow just ignore me im gonna go to sleep sorry for the essays lmao
Does anyone know why steam isnt retrieving friends list on a packaged game but on a standalone its working?
If you are still learning you should not make you final game idea. Just make smaller systems to learn first
Could you ask this in #online-subsystems
i have struct in player state with n number of properties. what is best way to check which property is updated ?
i mean struct is replicated how can check on rep which property is updated ?
void OnRep_MyStruct(FMyStructType OldMyStruct);
Maybe you should move it outside the struct if you need specific onrep event
Or you can use PreNetReceive to cache the old value and OnRep struct compare with the new received data
OldMyStruct will be the old value of the struct.
You can then check which properties of the struct changed. As Stranger said.
i have almost 25 properties , and its looking good at all to check 25 on rep events
Which solution is the best for making replicated equipment?
like what most of online games use ? skeletal meshes and set master pose ? or there's better ways?
and comparing the values kind of same
What's wrong with comparing the 25 values ?
Make it not a struct if that's a bother
i dont make struct then still i have to make 25 On_rep event
which i can do with single event of struct
I question the fact that you need a rep event for every single replicated data here
Personally I hardly ever use rep events
Sure you need those for every single property ?
yes its player properties like shirt socks shoes etc
Well you dont have options here, either you move the ones you need out of the struct
or compare all the values and extract the changed onces
Not sure why that needs to trigger code everytime it changes but hey
Just test the previous value
because i have to change the assets of local player when its trigger
If you actually have different code to run for each single independent property I have no idea why either solution (25 events / 25 ifs) is a problem
because its same code
same int8 chencged i have to write 25 times same thing
with diff name
i want somthing genric
macro is same
Do a macro that does if struct.PARAM != oldstruct.PARAM then MESHNAME->setstaticmesh(struct.PARAM)
Then you have 25 lines
Why do you even need the old value if you are going to set the new one on rep anyways?
i dont get it
There are like 5 ways to solve this
i dont need old
you said u need to check if changed you cant do that without old value
what is i create a struct with type and value
and create one on_rep
pass type and value
it that make sense ?
it will be called when one or more props change in the struct
you gonna set what you need onrep anyways?
Let's say you have a single struct with 25 properties that are all associated to a mesh, and a single rep event for each. You can write a template that takes two inputs (old and new) of a random type (the property) and a mesh, and does "if new != old then setstaticmesh(new)" - and override the template through specialization, for each supported property type (static mesh, skeletal mesh, etc)
is there any way to know why on post login is being called twice??
Then your rep event is exactly 25 lines long - it's 25 template calls
updatePropertyIfChanged(old.shoes, new.shoes, shoesMesh);
Easy as pie
maybe you have 2 players?
yes i want somthing like this
I dont tho @lusty sky
did you check the scene? even a manually placed player can be possesed if you set it
not only spawned from game mode
no players
lol
you are check on server ?
// do one for each type you need
auto updatePropertyIfChanged = [](const UStaticMesh* Old, const UStaticMesh* New, UStaticMeshComponent* Mesh)
{
if (Old != New) Mesh->SetStaticMesh(New);
};
updatePropertyIfChanged(OldState.Head, ReplicatedState.Head, HeadMesh);
updatePropertyIfChanged(OldState.Shoes, ReplicatedState.Shoes, ShoesMesh);
// etc```
Give or take minor syntax etc
Could be a template or whatever
its mean i i have to check each value ?
struct property { T type ; T Value}
onrep_property(proprty p);
is that make sense ?
I don't know what to add I literally just gave you the entire code
yes you did thank you so much .
but i dont want to compare values
Then write 25 rep events
this is also dont want to do π
It's going to be one of those
hmm okay thank you so much
Last night I decided to learn Unreal Engine (I'm using Unreal Engine 5) and I'm trying to make a movement system work for all players
some stuff works
but specifically my method of dash only works on the first player
this is the blueprint for the dashing
When I set the Net Mode to Play as listen server, the client that runs in the viewport works fine but the one that's created as it's own window doesn't
The Client in the Viewport is the Server
What you are doing there doesn't work because you are only doing it locally
Also, this is the worst thing you can start with when learning UE4
Multiplayer is already hard, but Movement in Multiplayer is even worse and theoretically requires proper C++ knowledge
I would strongly advice you to not learn this as the first thing. It will burn you out instantly
@eternal mantle
But in case you still want to do that to yourself, check the Compendium that is pinned to learn about RPCs and Replicated Variables
Ah well, my programming knowledge is limited to python and html/css
Will do!
Then stick to Singleplayer, honestly. Learn the Engines framework ( the classes, what they do, what you should use them for etc. ) first. Learn a bit about how to references objects properly ,because that will give you a headache one day or another (there is a stream pinned to #blueprint ).
I would even suggest learning C++ at some point, recreating your Blueprint stuff to gain an understanding of how C++ with UE4 works. best would even be if you learn the C++ fundamentals first, without UE4.
And then you can start doing Multiplayer.
If it helps, I've made basic games in Unity and Source Engine as well.
All I was wondering is how networking works with blueprints
I think the only thing that helps is a wider understnding of things
Like, Unity and UE4 are different enough that it might harm trying to apply Unity logic to UE4
But yeah, if you just wish to learn networking, check the compendium
What is the best way to test multiplayeer games on steam? With a friend? and do i have to package and send to him everytime i update something to send to him?
"best" is hard to define but you can simply push a new build on Steam, ask him to restart Steam so that the update goes through, and try together
After packaging, yeah
If you don't package you have to share the entire project through source control, which would involve installing Unreal and compiling the game on his machine
Also highly recommend having more than one machine at home, make it much easier to debug and catch issues.
Also doesn't depend on someone else π
That too
Not always practical ofc.. but uber useful
Virtual machine doesnt work?
Not tried it myself
So currently i have a Node to handle accepting invites that looks like this it only works with steam invites
i want to make a accept button on a hud
to accept the and join a session too
For example like this
What could i do to make that happen
When i run my dedicated server and connect with a client, i get this, followed by a crash on the client. The problem is probably "no game present to join for session", but how do i host a "game" for the session?
Looks like the server isn't actually hosting a session, hard to really tell anything though tbh
The crash could be anything, you'll have to debug that.
If they join then immediately crash, the crash is likely in your gamecode. Be worth fixing those other warnings too.
ait
Is there anyway i can get the session im in?
You can get session info yeah, from the OSS
The Session Interface should have a means to get information about a given session.
u know about any documentation / tutorials about it?
if (Subsystem)
{
const IOnlineSessionPtr Sessions = Subsystem->GetSessionInterface();
if (Sessions.IsValid())
{
const FNamedOnlineSession* Session = Sessions->GetNamedSession(GameSessionName);
if (Session)
{
FString ServerName;
if (Session->SessionSettings.Get(SETTING_DCID, ServerName))
{```
Usually quicker to just go digging yourself, tbh
About 95% of multiplayer is not available to BP
So it's unlikely, I would say. Don't really know though.
If you really want to get into MP, I'd strongly suggest getting at least some primitive C++ skills. Will be essential at one point or another
Yea i guess i will have to do that
Maybe the advanced sessions plugin exposes some stuff, but I'm not sure. It's pretty popular IIRC
Im using it
is this what exposes to blueprint? and can i just put the session variable there for it to expose?
Well you have to update all the callsites too
Hi, I have a question regarding passing Actor reference over RPC, what actually gets passed over the network?
How I am imagining it atm is : all actors have a network ID of sorts, the network ID gets passed over the network, and the other end do some sort of actor lookup using the network ID.
That's exactly it
So it is not that bad to pass Actor over network?
No it's not bad at all, if you need to do it you need to do it
Ahhh, great, thanks!
Been looking for 2 hours about it but does someone know how to implement in game invites?
i cant get my own session result
Which platform ?
So what did you do yet ?
Tried getting my own session by various ways
tried exposing Session on Create Session Advanced
but im not good at c++
Did you try the "send session invite to friend" node ?
What's that ?
For example this appears
It would be perfect if there was a CreatedSession return on this node
But i dont know if its possible to do it by c++
As far as I know this isn't possible with Steam
As far as I know with Steam you'll get the request through the Steam overlay, accept or decline there, and that will fire a callback
Not familiar with other online platforms
I know that I had that shit working ages ago for steam
3 years ago or so I had in game invite UI
Yeah i searched on discord things to do with this subject and saw you saying you got it working
but it had something to do with SteamSDK
100% sure because I know I had a crash when creating a widget from the callback cause of game thread shit
You can try implementing it yourself with Steamworks to check if the GameRichPresenceJoinRequested_t callback fires before you acceot
Maybe they changed that part of the API
You 100% need cpp for it. Don't think advanced session stuff has it implemented
I used the actual SDK for it, correct
With like STEAM_CALLBACK macro or so
Been too long
Yeah that just seems too complicated on steam, with EOS is it possible?
Check the EOS plugin I guess
Assuming you're going to change your online platform over a remote detail
Yea nah not worth it but damn it would be good to not depend on steam on that
Depending on EOS instead isn't exactly better
Arguably it's much worse since your users will need an EOS account while playing on Steam
I think it was this
And then you do something like this STEAM_CALLBACK(USomeClass, OnPartyInviteReceived, LobbyInvite_t);
GameLobbyJoinRequest_t is for when you accept the invite I guess
At least that's how it reads
C++ only right?
Yeah
Yea im horrible at it
Yeah that's not good when you want to make Multiplayer games
Blueprints only have a fraction of stuff exposed for multiplayer games
Yea i think ill start a tutorial a lot of problems lately have came from not knowing c++
is there any steamsdk tutorials for ue4?
This is also only for lobbies
I don't think there's a simple game equivalent
Afaik the Subsystem uses Steam Lobbies anyway?
I never had issues using those types of invites
To invite into games that is
Hey fellas,
iΒ΄m currently trying to understand how to implement Multiplayer Gameplay for my game. Im aware that there are different ways to achieve multipalyer for a game. I decided to go with the Dedicated Server Approach (headless Server), which clients can join.
IΒ΄ve set up everything i needed, 1. Build the engine from source, 2. added new build target for Dedicated Server Build. 3. IΒ΄m able to run my packaged Server and connect to it, via Standalone Client (Game) by typing in the IP of that local server running on my machine. IM using also Advanced Session Plugin and would like to use Steam Sessions Plugin in the future. But I would like to get some things straight first.
here are my questions:
"How does one impl. dedicated Servers logic properly?"
-
A Ded Server is hosted on a machine, and creates itΒ΄s own Session (Game Instance). Is this correct?
-
If 1. is correct and the server makes his own session, do or can i create a Session with the advanced session plugin on my server, to let clients join by session, other than by IP adress (open leve: IP)?
-
Whats the difference really, between Dedicated Server Hosted Games (Session) and Listen Server Hosted Games (Session)? Despite their big difference, that the Listen server Client acts as auhtoritative client (Server)...
-
For making a Server Browser for dedicated Servers, I probably need to provide some custom Logic, to retrieve my hosted dedicated Servers right? Since, iΒ΄m not able to simply make: Find Session, and get my hosted Dedicated Servers as array back, right?
-
Why do i get session results wiht Listen Servers Hosted Games, LAN or Internet, and not with Dedicated Server Hosted Games (also having a game session running, but probably not Advanced Session used?)?
IΒ΄ve searched for answers to this topic online and in the forum of Epic Games, but there are several threads that seem to ask the same questions. I Would like to clarify this for once and for all.
thy in advance π
is there an event on prelogin node? (idk if this should be posted on this chat or in the blueprint chat)
Hi, I am trying to sync Inventory UI and the items in Inventory.
The flow is :
On Item added/removed to/from Inventory
Inventory's ItemList RepNotify is triggered
On ItemList RepNotify is called
Fire event to notify Inventory UI to update
however, since I can't pass any data along, the UI can't tell what Item has been added/removed from the Inventory.
So, I thought maybe I should try invoking a Multicast RPC whenever I add/remove Item from Inventory , that way I can pass data along to tell the Inventory UI what Item has been added/removed, but then I discovered another problem. When the RPC is fired and the Inventory UI received the data, the data passed along is not yet replicated on Client's end.
Is there a better approach to do this?
PS: ItemList is a TArray which contains items that have been added to the Inventory.
How can I guarantee that the first replication bunch a client receives about a newly created Actor contains modifications I did during its creation?
For example, anything I do in BeginPlay isn't part of the first replication bunch, so the client could access incorrect data (because it doesn't contain the custom setup steps that were done in the server)
Which lifetime methods are safe to use with this goal in mind?
And how does that combo with deferred spawning?
Already answered, anything modified in all of these methods but BeginPlay are guaranteed to reach the client on the first bunch
I'm not that advanced into multiplayer, but do you really need to do a RPC for the inventory? why do all the other players need to know about the state of the inventory
RPC is a bad idea
Any events should be driven from OnReps only
RPC's for Events, Properties for State
Follow that rule and wave goodbye to 50% of your MP bugs
Nope, preferably I prefer not to use RPC for the inventory. I am just trying to figure out how do I let the UI know what Item has been added/removed from the Inventory.
As for multicast, oops, because I am just testing out the solutions XD
BP or C++?
C++
You can pass the "Previous" version of a property into an OnRep, then compare it with the current, and fire off events for added and removed items
But to be honest, I would just rebuild the whole inventory UI on any change
wait, you can pass data into an OnRep?
I am actually very tempted to just destroy all widgets and recreate them whenever there are any changes.
You don't even necessarily have to destroy them
Just shuffle existing items around or reassign them etc.
You can't pass data to an On-Rep as such, but there is an automatic feature that isn't as widely known
TArray<FHTG_TeamData_Dropzone> TeamData;
UPROPERTY(BlueprintAssignable, Category = "Events")
FOnWaveDataChanged OnWaveDataChanged;
UFUNCTION() void OnRep_TeamData(const TArray<FHTG_TeamData_Dropzone>& PreviousData);```
When that OnRep is called, the "PreviousData" property will be the state of that property before the OnRep was called and the property updated
So you can compare current vs previous version in the OnRep, if you wanted to
I don't bother though.. in this specific case:
{
OnWaveDataChanged.Broadcast();
}```
My UI just subscribes to that event and updates whatever it needs
It's a bit easier that way, the UI doesn't have to handle any intermediate states and it cuts down on delegate calls, especially dynamic ones which could be slow
And with good management of the UI you can avoid creating/destroying widgets each time
Just shuffling things around and reassigning etc.
HMMM.. okay, I shall try reusing the existing widgets, adding in missing ones and destroying extra ones and see how it goes.
Thanks for the help and your blog on the UObject replication! It's a big help!
Anyone got any clue as to why I'm crashing when playing on a dedicated server as a client? I don't crash when playing as a server
https://cdn.discordapp.com/attachments/878613204064944148/880452692563071056/unknown.png
SP?
singleplayer I suppose
I want to spawn an actor only on server, it should not spawn on clients? How do I do it?
Off the top of my head, Gamemode is server only. Could spawn it via that and then have the actor have itself as replicated? That should mean only one is created.
GameMode is irrelevant here, if you have authority and have World context you can spawn actor from any where on server and it will spawn on all clients
I want to spawn server level game helper actors.
no clients
Okay so object should only spawn for server and not be replicated, is that what you're attempting?
not replecating, the actor should not spawn on client side at all
Could you not just set the actor itself to not replicate? When you spawn it on server then it shouldn't appear for others?
correct
ohh man, how could I skip that.
That's why I suggested GameMode. It is server-only, any object spawned from that with replication would appear for all clients because of said replication.
it has to be there in world at runtime
why does it need to be in the world?
It might help if you tell us what this object is.
It is a kind of player manager, which sorts the player based on distance and other stats, and it gets these info from the map.
A UObject is perfect for that
just create a reference to it in your gamemode as a singleton
and boom, full access
Okay I'm kinda curious what mechanic would need to know player distances from its physical location but also not need to be known to clients.
spawning system I would guess
for my AIs
I tend to prefer my managers being components on other major actors like GameState or GameMode. Easy access via GetGameMode/State->GetComponent, and they have access to tick if required. And are also easily replicated if necessary.
You can give UObjects access to tick fairly easily
by hooking into the world actor tick
The only reason i'm saying use a UObject is that an actor has a lot of stuff you don't need if you don't need replication
but with actors its very easy to communicate with world
You can override GetWorld in UObjects and use it's outer to get world.
Yes? So you would have a non-replicated actor in the world spawned via the gamemode. It will only exist on server but be in the map. At least to my knowledge.
Unless I'm mistaken on that? You can spawn physical things via gamemode right?
yes you can
You can spawn anything via anything. The spawner has no bearing. The only thing that'll matter is which machine it's on, what class it is and if it's replicated.
what do you need to communicate with the world for?
Just pass w/e you need to the manager
or override GetWorld() to get it, and then you'll have access to more things.
Apparently they need a physical location in the world to measure distances to players? Or something.
wait wait wait
What are you trying to do. Please explain in detail
Anyways on a completely unrelated note before I forget why I came here.
I'm wanting to use a datatable to store all information about weapons. Plan is to use a generic weapon class and populate instances with different data to make it into different weapons rather than have different weapon classes. I'd rather the datatable stay on the server, but figure that players will need to be able to access it. What would be best place to put this, the GameState?
the idea is to maintain the players list instead to doing GetAllActors everytime.
the players playing, MOBA 5vs5
I've seen people do that as well as just store it in the actual weapon as a data asset. Both have pros/cons.
you already have access to that
from the game state's player's array
Pretty sure GameMode has a property for all players connected.
i know that, its plain array , I have custom logic to get players in some order for AIs
Yes it has
by server you mean dedicated server or you BE server?
why not use OSS, instead of coupling DB with your dedicated server.
OSS?
Because I'm not sure how I would use the subsystem for this purpose. And the weapons would be unique to the map in question.
4.27 has this plugin
I'm not using 4.27.
why do you think if clients have weapon DB, it will cause issues?
Cheating.
Or at the very least desync.
If its server-side then we know all players are using the same data.
let client have db in encrypted form (server has encryption key) and server validate and decrypt the client request, if request seems to be not legitimate then discard the request. Thats the true purpose of server validate not host data.
if you host db at server, you first replicate data to each client everytime, it will increase you server bandwidth cost.
what do you mean man... only the server should be able to access a database
this is not the db in size of TBs
it will max have 300 rows
data tables it is a form of db
what's the point of using it if client can access it?
I just realised ProjectileMovementComponent is not using state synch to update UpdatedComponent's velocity. What do you guys do to keep transform synchronized between client and server?
if some one wants to know your db, they can intercept the network and know all the weapon entries
CollisionComp = CreateDefaultSubobject<USphereComponent>(TEXT("SphereComp"));
CollisionComp->BodyInstance.SetCollisionProfileName("Projectile");
CollisionComp->OnComponentHit.AddDynamic(this, &AProjectileClass::OnHit);
ProjectileMovement = CreateDefaultSubobject<UProjectileMovementComponent>(TEXT("ProjectileComp"));
ProjectileMovement->UpdatedComponent = CollisionComp;
the collision comp should be root for the rest of scene comps
Does xbox and switch offer the same kind of p2p session system that steam does out of the box? As in calling generic session interface code is all that is needed to find games and host sessions without the need for dedicated servers?
I was actually asking something else, but thank you
State synchronization is a pattern used on networked movement components, used on CharacterMovementComponent (https://gafferongames.com/post/state_synchronization/)
I realised PMC just updates velocity locally on everyone
what you mean locally on everyone?
isn't the actor replicating movement tho?
that stuff is 6 years old, and may not be valid anymore. @peak sentinel
Ah yes, I knew I was missing something
Thanks
There might be better approaches but pattern is same pattern, as far as I know
keep an eye on Network Prediction though
For a DataTable, what would be a example case where only the server should know about it ?
UE5 has GameFeature stuff where you can add DataTables to DataRegistires either to client or server or both
in 4.27 The GameFeature Editor UI is not implemented, but code is there
My problem is more like to understand what kind of data should only be on the server rather than being there for both π
So they made it specifically for UE5 ? it exists since 4.20 or lower
ohh my bad, there isn't any rules as such
as far as I know its UE5