#multiplayer
1 messages ยท Page 643 of 1
ahhh okay that makes more sense, it didnt hit ClientTravel on join
i'll look at localplayer
The logic in the character currently goes like this: [Key] -> calls Event in the Actor BP. In the Actor BP itself, it just does the usual logic after the event got called. Is that how you meant it or do I maybe misunderstand something?
FString ULocalPlayer::GetNickname() const
{
UWorld* World = GetWorld();
if (World != NULL)
{
// Try to get platform identity first
FString PlatformNickname;
if (UOnlineEngineInterface::Get()->GetPlayerPlatformNickname(World, ControllerId, PlatformNickname))
{
return PlatformNickname;
}
auto UniqueId = GetPreferredUniqueNetId();
if (UniqueId.IsValid())
{
return UOnlineEngineInterface::Get()->GetPlayerNickname(World, *UniqueId);
}
}
return TEXT("");
}
I assume this will further down the line give you the PC Name
SubsystemNULL probably does that
That's prrroooobably where the Nickname is then used to send it along
GetNickname is virtual
So your best bet is to override that
Make your own LocalPlayer class
You can assign that in your ProjectSettings
I would do something like testing if NullSubsystem, then return some random generated name. Otherwise do the parent implementation
Thank you so much!
I do have to note that I suggested that right at the start haha, maybe too vague
Alright crap i've got another question, how can I tell if the current subsystem is null subsystem?
i assume i can probably just get the subsytem and cast it but it seems like i can also just pass in a FName and see if it exists
oh here we go
IOnlineSubsystem::Get(NULL_SUBSYSTEM)
Hello guys, I'm really lost on this problem trying to solve it for a while now, I have 1 client, 1 server players, both of them have their health displayed on the screen, when I created a pain volume to test if the replication works for health, it worked, but when the health reaches 0 it executes this code player->handledestruction() my problem is this code only works on the server
it does not work on the client for some reason
void AGrudgeDotssCharacter::HandleDestruction()
{
if (bDied == true)
{
UE_LOG(LogTemp, Warning, TEXT("You are dead!"));
Destroy();
}
}```
heres whats inside handle destruction
No, I'm not using
I assume client can't destroy it, because it doesn't have authority over the actor. Meaning it was spawned by the server. So only the server can destroy it. And that will then happen on clients as well.
If you want to destroy it when health is 0, then only check health on server side and then call destroy. And to check that you could use Actor::HasAuthority(). Or you can use Actor::IsNetMode(ENetMode).
I feel a bit lost here, ```cpp
void AGrudgeDotssCharacter::HandleDestruction()
{
if (bDied == true)
{
if (AGrudgeDotssCharacter::HasAuthority())
{
UE_LOG(LogTemp, Warning, TEXT("You are dead!"));
Destroy();
}
}
}
it still only works for the server
You're saying the actor gets destroyed on server, but not on client? Also the AGrudgeDotssCharacter:: is not necessary to call the method, I just wrote it to indicate that the method is defined in the Actor class.
My problem Is I need to set up my code to identify who is the client and who is the server, so all these problems won't appear right?
The check looks correct with the HasAuthority(). So it should already only be executing on server.
so ```cpp
if (!AGrudgeDotssCharacter::HasAuthority())
?
I just started networking with unreal today, so don't mind my stupidity ๐
If you do it like that, then it will execute on client. Which is not correct in this case. Leave it as it was before. And no worries, networking takes some time to grasp especially at the start. It's a different way of thinking than singleplayer.
I'm not clear what is not working for you at this point? if (HasAuthority()) should do the trick. The actor's not getting destroyed?
Its. only for the server side
Is the actor set to replicate?
How do I tell a dedicated server to open a new level with blueprints?
one sec
I tried using the open level node but it seems to not work
OpenLevel is correct on server. Has to work.
hmm ok, if I had seamless travel enabled, could that break it?
should "Absolute" be checked? anything I should put in the options string input?
You should try checking it for sure to see if it works. If it's unchecked.
That looks correct.
So what exactly is the problem? I even deleted the bdied and still the same
handle destruction is getting called from the gamemode
Is it a matter of concern? I think yes?
Ahh, then you didn't even need the HasAuthority() check. Since gamemode only exists on server.
But no, it should still work from there.
void AGrudgeDotssGameMode::ActorDied(AActor* DeadActor)
{
if (DeadActor == PlayerOne)
{
PlayerOne->SetDiedTrue();
PlayerOne->HandleDestruction();
HandleGameEnd(false);
}
}
hmmm if everything is normal then why it doesn't destroy the client ;__;
What does PlayerOne refers to ?
Hi everyone, is there a way I can find both dedicated and presence (listen) servers? Currently FindSessions only sees listen server if the SEARCH_PRESENCE flag is set to true, but this then means dedicated servers cannot be seen. Setting both SEARCH_PRESENCE and SEARCH_DEDICATED_ONLY to true means only dedicated servers can be seen
I could add an option in the server browser so that the player can choose if they see public (dedicated) or private (listen) sessions, but ideally it would be nice if I could just have all servers visible in one go
is it possible with blueprints to change the server name
what server name?
@hybrid zodiac you could make 2 queries and mesh the results together
Like when you were to get the session name and it gives the hosts PC name, how do I make it not show that but show maybe like a custom server name or a code or something
should be able to set settion data
hi , i'm having looong hard time trying to get simple setup to work with no luck
i'm having a npc character on the map that has string variable on it
and i got a widget on my playable characters made of 3 buttons
to set the value of that text on the npc
THE PROBLEM WHEN I PRESS THE BUTTON TO CHANGE TEXT
- on the server the value changes for the server and client
- on client the value changes only on client
so how to change a value on the server
only way client can affect server is via Server RPC
and it has to be sent through the client owned actor
= PlayerController, PlayerPawn, PlayerState, their components, and any Actors that are owned by those
so what i'm getting is
put the variable on the character controller
and put the event on the player controller and make it multicast
then the button onclick event will get owning player controller and call event on it ?
no
clients don't have other clients PCs
so replicating variables and MCs works only for owner
PC sends a server RPC with string input for the name
then sets the variable server side
MC is not required as variable is replicated
done a little research so what i have to do is
0 - the event should be on a client owned actor say controller
1 - check if i'm on a server or client
2 - a ) if on client call event that is set to "call on server"
2 - b ) if on server the event should MC to all
it worked thank you so much
i been struggling with that for about 1/4 a day
the problem was i didn't know what i don't know
had no idea of the "OWNING" and how it works
Has anyone every used the Circle Damage Indicator Component from the market? I'm trying to get it to work with a MP project and I'm not sure how to get it sorted. If not, any thoughts for another alternative?
EDIT: I did get it to work, replicated. If anyone else has the same issue, let me know.
Hey everyone, I'm having some issues getting my game online through the steam subsystem.
I'm running 4.26.2, my
Ini file is set up with all that jargon, my plug in for the steam subsystem is enabled, my build file has a line of code for the subsystem, and I added a c++ actor.
Why is my game not working with steam?
how can I reliably tell the server to do something?
I keep running into really annoying replication problems because sometimes the server's like "No fuk u i wont listen to you" despite events being set to "run in server" or as "replicated"
i am worried this has something to do with authority or owning player but i don't know how to reliably tackle it and it's getting to my nerves
well this is my problem
I'm pretty darn sure
but i still have no idea how to fix it
Guess you need to make sure the RPC is made from within an actor that has the right ownership
Im not very well versed with this, sorry
I am modding a game (with an SDK) I got a tank's commander seat telling the tank itself to open a hatch, and it wont listen, I'm not sure at all how to make sure it has the right ownership
am I just supposed to always get the player seating in the commander and make it the owner of the commander?
won't that cause issues or conflicts with the game's original code?
Also is there any easy way to get the information of which player /actor owns each thing?
because that'd probably help not have to fix everything by making whatever thing i'm trying to have change it be the owner
It all starts with how any interaction takes place. Eg. If your player has to "activate" something to open that hatch, then you may want to do the "Run on Server" event from the player's controlled character or their player controller.
No one would be able to tell you anything about the code that you may be using unless they're actually familiar with it.
You can always try calling "Get Owner" on actors to see who owns it.
Why trying to mod a game with Multiplayer if you are lacking the basics though
^ is the vehicle spawned by the owner/actor? -or by Server/default on? -maybe try set owner, if no owner exists?
Should be better if you first learn the stuff in a smaller, empty, new project, where you have full control over.
because the devs made no documentation :') (yet, to be fair to them it's only had an SDK since half a year and they have their hands full)
The problem you are facing is not the devs docs fault
You can't execute a ServerRPC in a Server Owned Actor
At least not from Client-side
I'm using the get owner and printscreen to try and learn more, hopefully that may help?
You need to go through a Client owned Actor. Either Character, PlayerState, Controller, a Component on those or by making sure the Actor you use is already owned by the Client.
That will only tell you who owns it
that's the idea. It could help me learn how i can replicate it, right?
since I know what actor i have to have calling the actions
I'm doing my best quq
Replication confuses me, that's why I asked for help. So far i've been making it work somehow by probably very spaghetti-od code but i feel it always takes me a lot more time than it should
Yeah I would not try to learn Multiplayer by modding a game
Makes a lot more sense to learn it with your own small project where you can try things with simple and small actors
I'm not trying to learn multiplayer by modding a game, I'm modding a game which requires me to learn multiplayer xD
Then learn Multiplayer first
Make a new Project and place a replicated Door Actor into your Scene.
Try to open that with a Client
Once you have that solved you know a lot more about how to structure your code
Very simple but hard test
Sorry to bother you again, but do I need to forward ports to have my dedicated server through steam show up in the server browser?
I've already replicated multiple things. I know the basics from tutorials and stuff, so idk if a simple door would help
I would assume so @digital current
Which ones? 7777 and 27015?
Well Ownership is basics @rough jolt And it seems you didn't know about that a few minutes ago :P
7777 is for the server to just be joinable. I think 27015 or 27016 is the query port of steam, yeah. But please stick with #online-subsystems
I highly suspected it was an authority issue, I was more asking about a way to fix it reliably.
like- i'm by no means an expert
but i've done the equivalent of a door
tank doors tho- apparently that's what gets me
Well okay
(tank door message was a joke)
The Tank or Tank Door is most likely not owned by the Client.
So you have to go over a Client owned actor
That's all there is.
this is what i get when i print the owning actor for the tank commander seat BP
printing the owning actor for the tank itself just retrieves "Client 2: (empty space)" multiple times
I tried to check the output log to see if there was more to it and my SDK seems to have crashed
Are there two players in that Tank?
Now that you mention it i don't think i had any players in the driver seat. that could be why
I'll test as soon as i restart the SDK
The Owner can be the PlayerController of the the Driver
Then Client 2 can't print that anyway
And the Client 2 also wouldn't own it
It makes sense that the driver owns the vehicle
So you can't use the Owner here anyway
what does this mean tho? does the BP have a different owning actor on each game instance?
BP_PS_PlayerController is the player of course
BP_BobSemple is the tank
VehicleArmoredMedium doesn't sound familiar
worst part of this is that i've done this exact same thing with the gunner instead of the commander of a tank and it worked, yet the same code won't work for the commander, despite both gunner and commander seeming to be handled very similarly by the game
Is there more than one Actor involved in that Tank?
And if so, are they all marked as replicated?
Hi, I'm really searching for an answer but just cannot find it. I have a custom struct that I would like to create a custom NetSerialize for. I created the function and also added the templated calls like in the picture below.
However when I call RotationInfo.Serialize inside the FCharacterNetworkMoveData::Serialize the debugger says that it just doesn't fire this function (even though I'm running it networked). What am I doing wrong?
From what I underestand, the chassis is a pawn and then each aditional seat that isn't the driver (commander, gunner, machinegunners) are pawns that are attached to the driver / chassis pawn
And would assume they're all replicated since i'm using modified duplicates of vanilla tank files so if they are not... that'd be odd
Can confirm, the tank itself is owned by the player controller
Wait, does this mean the code to open the hatch needs to be in the player controller? Cause that feels a bit odd considering it's a completely different player from a different seat opening the hatch
Well
In theory you would make sure the Player who is controlling the specific part of the Vehicle is owning it.
But that can't always be given. E.g. a normal car with 3 passengers might still be owned by the driver.
So yes, you have to route the RPCs through the Player first
But if the player who wants to RPC is the one owning it, then you don't need that
problem here is the reason why i'm having to do all this though
The commander hatch is on the chassis, which is the driver-owned part of the vehicle
If the commander was on a turret or something with its own hatch this would've been a no brainer since the vanilla game already has framework for it
You should really first figure out who the f is owning what part of the vehicle at any given time
I tried to use the framework as well as anim blueprints to have both hatches be on the driver and the commander still be able to open the commander hatch and it worked, but as I posted in #animation the driver hatch would close whenever the commander one would open
And if the Player who wants to open the hatch is not owning it, then you have to go through an owned actor first
I'm sorry if i'm being a little slow, but that going through an owned actor thing- how do I do it? that may be the part i need to know to solve all my replication dilemmas
Simply calling RPCs in an Actor that is owned by the Client
Character, Controller, PlayerState, or a Component on those
I assume the is triggered by a key press
So KeyPress -> RPC -> (Now on Server) Get Hatch Actor -> Open
Also I just tested and the commander seat when empty is owned by the chassis, when a player is inside it its owned by the player
what if I just did all the code for the hatch opening on the chassis... like- casting to the commander seat and doing all the commander hatch opening code as it
i guess that mayy work?
thing is i don't know how to trigger it in the chassis since it's triggered (in vanilla) by an event that happens in the commander seat
If you have an Actor on the Vehicle that is owned by that Client, and you have access to it, then yes, that would work
RN i have a replicated variable on the commander seat. I'm checking on tick if it's on by casting to it from the chassis. and if it's on, then the hatch opens. I'm gonna test that
aaand it's only happening for the commander
found out why. the variable isn't replicating at all for the commander for some reason
OK i think maybe i got it
it worked! :D
@thin stratus thanks man, i think you helped me underestand this better :)
What do I have to do differently when hosting a dedicated server compared to p2p with online sub system?
does anyone know the correct way to get LogHandshake outputs? I dunno what I am doing wrong but -loghandshake doesnt work for me
You mean how to enable it?
Usually via config file or console log LogHandshake VeryVerbose
VeryVerbose being the level of log you want (and above)
Not sure how the config file has to look like again
Depends on what you are referring to
DedicatedServers usually override the GameSessions "RegisterServer" method to do the CreateSession stuff.
But please use #online-subsystems if it's about subsystems (:
Hello ๐ Is there any way of getting client's viewport size? Without doing any replicated set variable to track it?
I'm trying to implement a crosshair for shooting and it is a bit offset from center of screen
And I basically need that world location for tracing
GetBaseAimRotation on the Pawn
Eh
One sec haha
That's for rotation, so you can just use the CameraComponent on your Pawn
I'm also not quite sure what the offset has to do with the firing
Is it offset on purpose?
If so, do you know the offset? ANd if yes, just add the offset into the location?
your client targeting ultimately depends on the client
so let it handle its own crosshair
Hi, is there any way to get pass the ICMP blockade? I'm trying to get ping between players (using Victory Plugin to get IP, AdvancedSession for passing IP to client and PingPlugin by DescendentStudios) and I'm getting almost every time "Request timed out".
Of course if someone will allow ICMP echo requests it will work, but the trick is to get pass that windows firewall
Huh, is there maybe a plugin or something like that to use it through blueprints? It doesn't matter if it's open-source or on the market
i have a 3d mesh that moves and is supposed to push player off track if player gets too close to it, the character "shakes" when pushed by the object, how can i optimize this collsion wise , and also do i need to think about that its selected for replication since its a multiplayer game, can i optimize there aswell?
Yeah this is actually quite difficult to achieve tbh.
The best way I know to apply forces etc to players in a multiplayer environment is to use Root Motion and apply it on client AND server. If you don't do this then the client and server will never agree on the correct position which is why you get the shaking.
If you are using Gameplay Ability system, this part is actually a bit easier?
"Off track" sounds like a racing game
And Racing Games should theoretically be Client Authoritive
So the Client would tell the Server that they get pushed off the track
Pretty sure the Movemenet Component for Vehicles have some Client Auth boolean?
I mean, even if we ignore the "Pushed off by block" stuff, controlling a vehicle not client auth sounds problematic
Don't want to derail, but what about resolving collisions with other players?
Basically it is a third-person style camera but the crosshair isn't at the center of the screen
That is what I meant with offset
This is all basically to find where the client is point at to determine the target location for the gun shot
It is the same in screen location
Then you should be able to calculate it serverside
You can deproject locations from screen to world. So center of the screen + offset and then deproject it
I have worked on this a whiiiile ago I just noticed something, shouldn't I just be doing the shooting checks on the server then call the actual bullet line trace on client? ๐ค
Is there any real benefit on doing the line trace on server?
Thing about that is deprojecting requires 2D screen coordinates, which means I need the client's screen size
which takes me into the origin of this issue
Well
What I do is fire the weapon locally and on the server, and then via OnRep also on the Simulated Clients
But I can use the center of the camera
I wouldn't know why someone would want the cross hair to be offcenter
Sounds like that would only confuse people
Mecha games usually have free crosshair, cause they are like tanks
(sorry for my random comment cause I saw the off center cross hair one)
@silk abyss Can I have a reference please? It would benefit me seeing how some other games handle topdown/odd third person shooting
like hosting stuff in the cloud or something else?
you can probably find those on twin-stick shooter examples
But I was referring to Mecha game that you sit inside the cockpit and the reticle are hovering where you aim them.
(the mech can go/face different direction if developer allows it.
np, if you are looking for custom TPS ones, it shouldn't be too far off from those.
I think they usually do the HUD as a "guide" not actually indicating where it would hit
ie. say you have a gun that fire and trace to where the reticle aimed, but something obstructed in the middle(ie. side of a building when you peeking out) it would still hit the building instead of there the reticle is.
Yes the cursor needs to be used to calculate the end point of the trace and start point should still be muzzle
or whatever start point is
I remember what I did pretty long time ago I just basically did this(this is before UMG), so I have it setup as follows:
- the attached gun component would aim where the center trace is.
- I save the traced world location and guns muzzle position/rotation back to pawn every tick
- you can setup whatever replication method you want to update the server.
@gusty slate
so this way server doesn't need to know where player is looking at or whatever resolution player is using.
server just trace from muzzle to a world location
of course this is not ideal for anti-cheat etc if player found out about it. but consider it was back in early days of UE4 and I just do whatever I think is good at the time. there should be more consideration being put into it so that there is a balance from client side hit-scan to totally server authenticated movement/hit trace.(cause if there aren't rotation limit, player can and will rotate at whatever rate they see fit. )
Why would only one controller accept input when working on a local multiplayer game?
I tried a keyboard and a controller, and that worked fine before; two controllers is no dice
did you do the in editor listen/client or just tryiung to do split screen?
yeah, cool, so it's kinda tricky that way cause by default you will possess one screen while the "controls" follow whatever is the window getting possessed.
Can I show you how mine works in programmer parlor?
you might be able to find this answer hub, cause it was like discussed a couple times before.
I forgot the details about this but I remember I can use kbm on the server while my controller on the client
but I have never tried 2 controllers as I didn't have additional spare ones.
I got it to work fine with a keybrd and a gamepad, but it is disappointing since I wanted to have both players using gamepads
Set up the Unreal Editor for testing multiplayer games.
have you seen this page?
you might have to do the play in editor window one I think for the 1 gamepad per window to work proper(instead of standalone windows)
so use the "New Editor Window" option when you test.
thats what it feels like, because it ignores every controller I have tried for that second slot
how do you do your controls from player controller class to possessed pawn?
I know a lot of examples do controls directly on the pawn
so I am wondering how you do it?
I have them on events in the player controller. Watching a tuctorial rn, and they say to do it in the character, but that does not seem to be working
mainly trying to get any input at all from the p2 controller
have you see the input flowchart?
?
The Input object is responsible for converting input from the player into data in a form Actors can understand and make use of.
specifically this flowchart
if an input is "consumed" by one of the input component checks, it goes to game logic part
and skipped the rest checks
Its not going to the logic (Which is just a print string atm)
(but you could setup so it's not consumed as well.)
It works on P1 controller but not P2 controller
can you briefly post screenshot of your player controller class where it fires event from your action bindings?
(I need to be away for a bit, will come back later. )
You're pretty much on your own for something like that. If you don't want to use unreal's networking... just don't use it.
You'll be losing out on anything built into the engine though - no replication, no RPCs, no character movement prediction, etc.
- only exist on server side 2. this could be on server or client but they are different things.
so local player controller and server player controller have kinda mirrored relationship? don't know if I say it properly. it's like a locally player contoller sends rpc through the network to server's playercontroller receiver and then server playback the inputs for you on server.
on the client, 1 would fail to get anything really, and cast should be failing
Theres a server player controller?
yeah, for listening host, server player have it's own player controller
(it's the same class, just that server spawns one for each client connected.)
if you play with editor window, you should be able to go to the player controller BP and debug the player controller instance
see how the events fired and where the execution goes
How do you recommend I do the rpc?
so if you did have a listening server as setup(so it's players connect to other players) you need to set it up so it knows if it's on server or not
Using GetLocalRole() can tell you and you can check if you're authority there.
and say during begin play of your player controller, you can save it somewhere(variable, struct, etc) so you don't have to fetch that everytime.
so standard way(? or intended) is server authenticate, you send everything to server to execute and do all the game related logic on server.
of course the UI eye candies run locally since they just ways to display information
Does that mean the game is still local multiplayer if you have a listen server?
Ohhhhhh.....You want one screen for all players and not split screen.
So everyone is on server basically.
Then you need to use the Create Player BP node in game mode I believe.
I have that already made, the create player node. I made a function that prints strings for which player controller is inputting, but it still does not print for player 2
Check this one, the question is for split screen but the answer is how you setup those players/controllers etc.
Looks nice, thanks man
You don't have to implement split screen.
I figured it was not needed since it is just bp code
Im having this weird problem where if I use any gamestate other than the default one, half the things such as other characters are no longer replicated, and i litterally cant move the player pawn unless its the server. this issue wasnt present a while ago, and randomly appeared. I even made a new gamestate and the issue is still present. Any fixes?
The GameState and GameMode come in pairs.
GameStateBase | GameModeBase
GameState | GameMode
You cant mix these, you get inconsistent results if you do.
im using gamestate
Double check you arent accidentally using GameModeBase with GameState
Make sure your editor is in the right network configuration your expecting.
Play As Client etc
C++ or BP only?
BP
Did you accidentally turn off replication for the Characters?
UE4 is doing exactly as its told, you need to make 100% sure you havent adjusted something thats changed it.
it works now
i think
yeah
i think i might have done something without realizing
๐คท
As far as I'm aware the Gamemode is Server only right?
Meaning if I multi-cast a teleport to all Players in a foreach loop from it, it should teleport them all to the locations I provide?
gamemode is server only
Yeah, so if the server gets all Players and then casts to them with a Teleport it should teleport them all to where the Server wants them to be right?
Because Im having a weird issue where it'll teleport both clients successfully for the Host but the Client will have both users at the place before teleport
https://gyazo.com/6a486b020b4313d36da911dba4c1f27a Ok, I'm kind of out of my element here, but How would i synchronize the mass spawning of something in the server and client. This spawning happening here is all happening in the gamestate but somehow the client individually is summoning them, while the server is instantly doing it as its suppose to. Is there a way to fix this, would changing out the code into the GM help?
someone knows a good inventory's logic for a large player amount shooter game, i heard about FFastArraySerializer to manage items (since there is only count and owner that is changing.) but there is not so much documentation about it. My actual inventory is an actor component and my item an UObject and item definition, a dataasset. Im not rly glad about my current system cause it uses a TArray to manage my UObjects (items), should i go to use FFastArraySerializer ?
We use a TArray to manage our inventory in a 100 person game. We haven't noticed any performance issues related to it on full servers.
how big your UObject class is
The actual item
It's an actor at it's root
How many items can hold ur players on them
as many as we place really. But generally there's 6-7 items each.
actually more than that
as we have a hidden inventory for other things
so more like 15
Mmh k, thanks you ๐
np
each pawn is responsible for managing their own inventory. We handle that through RPC calls to not overload the server.
I guess FFastArraySerializer should be used when having a large inventory for players, base(houses or smth) that can holds large amount of items ? Like Fortnite STW or survival games like that. ๐ค
didnt know about this website at all, looks already better than UE docs, thx u ๐
Hi Guys, Are session region/ping locked ? I'm running some tests, i have 2 computers in 2 different networks and they can see each other sessions, but when i host a session ( i'm Living in Ireland ) and my friend from Brazil tries to find a session he is not able to find it
What kind of session? Steam?
yeah, i'm using steam advanced sessions plug in
I've successfully shared games with Australia, Tokyo and UK, so no there's no inherent region locking.
Do you have your APPID or are you using 480 ?
We have our own
do you think that could be a reason ?
as there are a lot of users using that appid i thought it might be one of the reasons
i see, but just to know that you were able connect with friends helped me already
๐
i don't think its port forwarding
because i tried with several friends
all of them are not able to find the session
or all of them have a very strict firewall rules hahaha
Are you using the Steam P2P network protocol?
Sorry I meant Steam Sockets
https://docs.unrealengine.com/4.26/en-US/InteractiveExperiences/Networking/HowTo/SteamSockets/
How to enable the Steam network protocol layer for Unreal 4 projects.
let me check , i not sure if i enabled that
Hmm interesting, i will try to use this and check the results
Thanks a million man
@silent valley Are you still there mate ?
hi
Sorry I just started work
all right no problem ๐
I'm not sure anyone would run a random exe on their machine either if that's what you're going to ask? ๐
If you can spare a few $ I'd suggest getting a cloud account/VM you can test with
there's no alternative - it's impossible to test Steam with two clients on one network in my experience
I'm managed to get it working with 2 machines from 2 different networks
but still having the same problem with my friends from brazil
i was just trying to see maybe with people from other countries would work haha
but i understand your point
it is not safe at all running an exe provided by a complete stranger ๐
if you have it working for 2 different machines/network that's a great start... I don't know why the friend in Brazil is not working
it is funny, they can find other lobbies from people using the 480 appid
but they can't find mine haha
are they definitely using the exact same engine version?
yes, i just packaged the project and uploaded myself
and gave them the link form google drive
at this point you're gonna have to grab the logs and starting looking through
I guess it could be due to lobby filtering based on ping/location, if you're using 480 there might be a lot and the Steam API will only return the top N results
I don't use the Advanced Sessions plugin, but there might be a way to filter based on additional criteria...
Yes i will give this lobby some love later hahha
or stump up ยฃ100 to buy your own AppID ๐
i'm so tired right now haha
you've done well, setting up Steam/Online in UE4 is quite a difficult process
it was a 12 hours journey today hahaha
multiplayer is being very hard for me
i have no experience in C++, but i know java
it is being hard to learn the different aspects of C++
i was trying to use the steam sdk and expose some functions to blueprint, but man... thats wayy to complicated for me
so i decided to stick with a simple lobby sistem xD
and YET it is giving a hard time to get it working properly ๐ข
Well, i need to get some sleep now, Thanks for helping me out man ! i really appreciate that !
๐
Does anyone know how i get the Host Ip? need it in a BP actor ๐ค
Hm, I'm half sure you need to ping some service for that as the Host doesn't know its public ip
Hmm, well that was a bit inconvenient
Is there a way to keep the player state connected to the pawn even though the player disconnected?
The playerstate has an AbilitySystemComponent, meaning if player D/Cs but pawn stays in world, it loses access to its attributes
Not usually. Player States have a "max inactive time", if a player re-joins within that time they will get a new player state, and a chance to copy properties/data from their old one.
Crap, okay :\
I'll have to mirror it on the pawn at D/C then or something like that
So other pawns in the world can still interact with the disconnected player's pawn
Well you can override how the Inactive stuff works though
You could override the AddInactive function and do the same, minus the LifeTime setting
Or set the lifetime higher than one day, your Server should restart daily anyway
Hmm, interesting. That might actually be the cleanest way to do it
Override the inactive flow, and maybe even reconnect the old playerstate when the player rejoins?
Or am I forced to spawn a new one for the new playercontroller instance? ๐ค
if a player re-joins within that time they will get a new player state, and a chance to copy properties/data from their old one.
If not this might actually already be nice ๐ค
Oh actually, couldn't I just keep the entire playercontroller alive and re-assign that? Player state and all
I did actually override PawnLeavingGame to keep the pawn in the world, so I imagine I might be able to do that for the PC as well ๐ค
Voila, there's already support for what I wanted to achieve with persisting the PS. I think this was a bigger problem in my head than in reality ๐ฅณ
Seems like it will work out of the box exactly how I want just by changing the timeout. I totally missed this because I was inheriting from GameModeBase ๐
Exactly right, that's also fine for me
Hi all. I'm using the Steam subsystem and I was wondering if it was possible to have players join a game without the game running. I have got invites working, but currently the invitee has to already have the game running, otherwise when they accept the invite it will just start the game and they sit at the main menu
you can use lobbies
If starting the game from an invite, or from clicking "join game", does UE4 start with extra parameters I can use?
they are basically a steam hosted chat that can hold data like a session
Interesting
I assume I would need to handle an "detect if the game started from an invitation or join request, and automatically connect to session upon starting the game" in the game instance somewhere
Do you know how I might determine this?
I had a look at some tutorials but I can't see anything specifically about joining a session upon starting the game from an invite, just handling an invite while already in the game
we do have invites running though
For the AddInactivePlayer flow, it seems like Epic went with duplicating the existing playerstate and storing that in case the player reconnects. Is this mandatory, or can I just keep the existing one alive as well?
It would make my life easier, but maybe there's a good reason why they do it this way.
I should note I'm not using the advanced sessions plugin
its duplicated, doesn't make your life easier to keep old one
i have no idea about that
there should be a steam API callback
when you start the game because of the invite
you need to reach to it and join the game
@winged badger Thanks, I'll take a look at the callbacks and see if anything pops up
Oh ๐ค
I asked because it seems like some components on the player state have internal values that are not duplicated (the abilitysystemcomponent's attributes). Or I misunderstood something while debugging.
non uproperty or transient stuff would get lost in the process
what Net Mode would all Player States have on the host's device?
depends on what kind of server it is
listen server
then ENetMode::ListenServer
usually best to do NetMode != NM_CLient
as standalone has its own net mode
yea but the thing is Im using EndPlay in player state to update UI in lobby to display current players in lobby, but when the host leaves and still there are clients in lobby the host tries to update UI while tearing down his lobby menu and get's really stuck for some seconds
but the question here is, clients each on his PC would have NM_Client, right?
yes
It's confusing for me
shouldn't it be NM_Client on the host's PC as well, since it's replicated to everyone ?
or is it that way because it depends on the current connection?
and not really related to the original client!
@winged badger Hey, in case you're interested in future, I found out how to launch the game straight to a lobby. If you accept a Steam invite and the game ISN'T running, then when it starts up it will have a command line argument +connect_lobby <id>
So in the GameInstance init function, you could check for that parameter and join the session right away
Pretty simple
nods i didn't implement that part
I just want to ask a question, It's not issue for me but I just wonder why.
I have a begin play event in my map level blueprint. I have 2 different Custom Events to call at the beginning of the game to make things ready.
Events are: Game Start and Spawn Items
When I connect Begin Play to Spawn Items first then Game Start, it works fine without any issue.
But when I replace the positions of events, Spawn Items doesn't called at all for Client after Game Start.
When I add Print before and after Spawn Items, they both called but Spawn Items doesn't call at all (for Client only)
What can cause that issue;
Here is Begin Play: https://blueprintue.com/blueprint/0u75gsws/
Here is Game Start: https://blueprintue.com/blueprint/6b32o0h0/ (Not Replicated Event)
Here is Spawn Items: https://blueprintue.com/blueprint/uptcr-55/ (Just to Inform, Spawn Items is Server Side Replicated Event)
I just wonder, why it's happening :)
And forgotten informations;
toController is a function from my library to call my custom Player Controller class from Default Game Controller.
toBase is a function from my library to call my Custom Player Character class from Default Game Controller or Default Player Character.
Trying to add a weapon switch mechanic via blueprints and have it show up for other players but I been stumped. I used the spawn actor and attach actor to component and was changing the visibility for every switch but it doesnt seem to pop up for other players despite the weapon actors having replicated enable. There somethin im missing?
alrigggggggggght so, all clients' player states when are on server, they operate on server and have the NM_ListenServer
got it
@rustic hollow check out the exi multi player compendium in the pins.
Ok )
It was a programmer who is no longer with us who implemented it. It's either EasyAntiCheat, Advanced Sessions Steam or Unreal itself which offers the protection against lagswitches
I have seen people with high ping or unstable ping get disconnected though. If I ever find it in code I will let you know but I'm afraid you'll have to research yourself : s
Could also be your servers are unstable
Bit of a long shot, this, but has anyone used the FindSessionById function within the Steam online subsystem? It was always returning as having failed, so I looked into the OnlineSessionInterfaceSteam.cpp code and the function appears to be stubbed out:
{
FOnlineSessionSearchResult EmptyResult;
CompletionDelegates.ExecuteIfBound(0, false, EmptyResult);
return true;
}```
It seems like it just always returns false and an empty result. Does anyone know what I'm missing here, or is this really an unsupported feature?
An overview of how travelling works in multiplayer.
if it's stubbed out like this, then it means it's not implemented for that OSS. also looks like we have an OSS-specific channel now (#online-subsystems)
yes there is?
@lost inlet Thanks! I'll take a look
in an MP game, you'd run ServerTravel from the server itself, which will result in all clients travelling to the new map as well
I'm not sure what World->ServerTravel is exposed as in BP, if at all
and you have a map called "1"? you also wouldn't really run it in the context of a player controller
ServerTravel as a console command is indeed the only built-in way to do it from BP
but that append makes no sense
the command is ServerTravel <map name>. You're giving it ServerTravel1
Even if you do have a map named 1 you're missing a space.
unhook the player controller input.
if you have players in your server, server travel will bring the players in that server to the new map when server travel is exectured
You're testing in standalone correct?
Anyone else getting this error on 4.27 P1? 'FUniqueNetIdSteam::FUniqueNetIdSteam': cannot access private member declared in class 'FUniqueNetIdSteam'
I'm using it like so: FUniqueNetIdSteam InFriendId(SteamLobbyCallback->m_steamIDFriend);
It compiled before just fine, any solutions would be greatly appreciated
Is there any built in command/tool in Unreal to visualize or debug collisions/geometry on a dedicated server from the client?
I don't think so. You can use p.NetShowCorrections 1 to display client and server locations when they mispredict which can be helpful.
You can also use GameplayDebugger to show various server information on client but I think you might need to add your own information.
Did you try Listen Server?
i setup advanced sessions
how would i go about making server passwords
and creating player accounts/logins
Hi guys, i was trying to learn how i can "limit" how far the player can see, but i have no idea where should i start from, any chances anyone could help me out ? I would be very happy with just the keywords to search on google
Red square = visible area , everything else should be dark
sounds like a fog of war @edgy valve
@short arrow thank you very much
few keywords you need to research on that : fade out distance in camera, cull distance volume, post process material, view distance quality, cinematic camera with lens settings @edgy valve
these are the ways, you can try any method to achieve the thing that you've asked
Hi! can someone orient me on how to create something like path of exile / diablo 3 where you have your own instance and others can join too?
@wheat magnet Thank you very much
Yo. I have this UObject that I'm exposing to BPs. From there, I'd like to call RPCs from clients. I believe this has something related to Ownership - so my question is, how can I achieve replication in UObjects?
If you want to RPC from the uobject on the client, the client needs to be the owner of the object.
and if its a UObject, not an Actor or ActorComponent
it needs to override a few things in c++
virtual bool IsSupportedForNetworking() const override;
virtual bool CallRemoteFunction(UFunction* Function, void* Parameters, struct FOutParmRec* OutParams, FFrame* Stack) override;
virtual int32 GetFunctionCallspace(UFunction* Function, FFrame* Stack) override;
plus the owning actor needs to be owned by your PC/Pawn/PS and actually replicate the UObject by overriding ReplicateSubobjects
@gloomy tiger
Hi guys,
For multiplayer FPS, how do you go about updating your UI on the client when a kill event happens?
Currently I base if off the replicated event of the kill count in the player state, but I find it lags behind a bit.
Another way is to use an RPC call and pass along the kill count with the player's name. This seems to be more instantaneous.
Thanks!
@gloomy tiger #multiplayer message
@winged badger Hey have you ever came across timeout issues after the client initiates the handshake protocol. The server never responds with a SendChallenge packet? I am running a listen-server model. The Server travels to gamemap but when the client tries to travel to server map, it times out because server never responds (w. SendChallenge)
If this event is an RPC in a parent blueprint, will it also be an RPC in child blueprint?
It doesn't show the description text
can you change the game mode with server travel or if you're going to use server travel you're stuck with the current game mode you're on? As of 6 years ago, apparently you couldn't, just wondering if that was ever changed: https://forums.unrealengine.com/t/any-way-to-use-servertravel-command-with-specific-game-mode-options/20462
It should be ,yeah
You can change the GameMode with every travel.
?game=GameModeShortcode
And GameModeShortcode can be set up in the Project Settings, under Maps and Modes
and the short code is the gamemode.gamemode_c?
ah okay thanks, I'll dig around in there
@somber glade Make sure to do an Absolute Travel when Server Traveling. What the Forum post encounters might be a Relative Travel.
okay I'll keep that in mind. Appreciate it
Now I feel dirty for reviving a 6 years old post, but maybe that helps others in the future.
if there is wrong information or stuff that needs clarification it's fine. This kind of stuff shows up in google searches
So servertravel mymapname?game=gamealias
It was kind of hard to find this information, so that's really helpful.
yeah I'm just running it as a console command from BP right now to try it out
My lobby on the marketplace uses the Console Command and works fine
I'll make a function for it later
@thin stratus One more question...if you're still around. If you start hosting as a peer to peer host and then server travel. Would additional users be able to join you on the new map, or would you need to somehow republish the session?
Yeah I have a host full bool that I set and that my c++ base checks before letting anyone in.
I could unset that if some users leave.
thanks.
You can probably store most of that in the session info no?
Why is the muzzle in the wrong position in the server
It should be directly in front of the barrel of the gun
but it's at the point where I am drawing the debug point
I think you can add more session settings via the advanced sessions plugin
@somber glade is your boss still allergic to c++?
Probably cause you are using something for your aim pitch that the Server doesn't know
hmm kk guess I'll just my do my calculations on the client with replicated properties
Should I set the timer for my full auto weapon on the server or on the client?
both?
Yeah
@fading birch It's not that he's allergic, I took the project over while it was already blueprint. There was no time for me to spend however long it would have required to move everything to C++, so I just add c++ when it's absolutely needed. The next one will be started from c++ from the beginning.
working in BP is fine, i was just pulling your chain lol
๐
Would you guys recommend having a separate first person mesh and a separate mesh for other players to see in a multiplayer game?
Or is it usually not worth the extra effort
It's not really that much effort with the OwnerNoSee OwnerOnlySee settings.
I find that first and third person meshes are pretty standard in most FPS projects. Not necessarily required though.
I meant from an animation standpoint, since there will be more animations to make
Really depends on your animation stuff and how polished you want it. Many crazy successful games barely have third person models walking and playing a few arm movements coupled with aim offsets. While fancier animations are kept to the 1st person.
Any tips on how to make sessions password protected? ๐ค
Add an advertised "is passworded" property to your session, when a client tries to join that session they then know that they must enter a password, server rejects or accepts the join request based on that.
Sounded simple enough, can i add that property to the standard onlinesubsystem?
Ah, woops, sorry and brilliant
They're generally basedon the same skeleton, so you don't really need that many extra animations.
Hello. What is the best way to know when a client has finished loading replicated actors? In my game players can build structures, which are replicated. When there are many structures on the server, after the player connects, it takes some time for these actors to be replicated. They are popping out for some time after joining.
I know that after actor is replicated, Begin Play is called, but I am not sure if it is the best way to check that. Besides it can be problematic if during loading, some players will place new structures or destroy existing ones.
I am looking for a way to detect that these actors are still loading to disable loading screen when everything is ready.
you cant really
you can fake it
i do notice sometimes in big games (Fortnite for example) that i can join a game (Private) and i see replicated actors just pop up out of nowhere
or dissapear out of nowhere..
you can always just give a couple of seconds after connecting.. unless anyone else has a better way ๐
wait, this is for hot joining?
i assume so
you can mitigate it a little, via replication graph, gradually expand range on which actors are replicated for that connection
prevent it, no
Anyone is using push model for their systems?
custom one here
I want to avoid adding timer to loading screen ๐ Maybe give each structure unique ID and then check list of loaded IDs on client versus what is on server?
Totally different from Epic's system or modified?
you can do that only if the list is predictable client side before he joins
totally different, but using engine features
I see, where do you use it, if I may ask?
I'm thinking to take a look but couldnt find any documentation (as always..)
Hello everyone
Can anyone give me tutorial for UE server with database? Even 8 hours tutorial from mumbling guy with bad accent will be fine
Everything I can find is server without database/database without server/author doesnt know what he is doing/it's made by rewritten 100 times plugins
It'll be 100 times better if you got tutorials with sql databases
In UE therere 2 built in SQL plugins but theres 0 documentation and the only one mention of these plugins is a reddit thread literally asking where they can find the documentation.
Actually I reminded once upon ago Zlo said Epic puts documentation to .h files
And I found it on PushModel.cpp/h
Hello guys.I am trying to spawn 100 Ai in my game.I am spawning them inside my gamemode using spawn actor from class.But Only 8 AI are being created.Is there a limit.If not plz help me.Thank u
Show your code please, just in case
They probably can't all spawn on the same spawnpoint like this
For now you can try to set the Spawn Collision to AlwaysSpawn and see if that fixes it
Thanks.It worked
if a VR controller is only being spawned so that the client can use a widget interactor to navigate a menu only they can see, does it need to be spawned on server? or is it fine since the widget interaction will be local to them.
If you don't need replication, it's fine
Hi everyone, might be a bit of a dumb question, but am I able to run SessionInterface->FindSessions twice at the same time with different callback handles? I want to run two searches, one for dedicated servers, and one for listen servers, but I want them to be populated into separate lists once completed. I suspect it isn't possible...
Pretty sure it isn't but would also likely depend on the online backend being used.
Can you not search for both and filter them afterwards?
@chrome bayUnfortunately not, FindSessions only lets you search for dedicated OR presence in one go
If you set SEARCH_PRESENCE to true then it will exclude dedicated servers, if you set it to false it excludes listen servers
IIRC Presence is more about players being able to join via friends etc.
Don't even think any of the online backends have an implementation for it AFAIK
Oh wait lol
The Steam OSS uses it to denote Lobbies vs Internet sessions. That doesn't seem stupid at all.
Man it's almost as if the bIsDedicated flag doesn't exist -.-
In that case no you can't, not without Fixing Epic's implementation of the Steam OSS
I guess it's a side-effect of abusing steam "lobbies" to do player-hosted servers
@chrome bay Ok no problem. I guess from a C++ perspective I can't run the same function twice with different callback handles? Or is that actually possible?
I mean, the worst case scenario is I just have to run FindSessions again from the OnFindSessionsCompleted delegate so it can run back-to-back searches
(obviously with a check to avoid an infinite loop)
Hey guys just wondering, I've read the documentation for a dedicated server and how to set it up for a game, but it doesnt seem to mention setting up multiple dedicated servers? How would one go about doing that?
You need to host them on servers. There are several options such as Gamelift, Playfab, Azure, etc.
You'll need to implement a way to find the servers that you want players to join. You can do this in a few ways. Gamelift provides a matchmaking service named Flexmatch which you'll additionally need to setup websockets and write some lambda functions on AWS. Playfab also does something similar. If you want to show something like a server browser, then you'll need to do a session search, which will populate your servers that are hosting sessions.
I just meant connecting to multiple servers, thats unmentioned in the documentation.
Like it says "To connect to a server over a network, you can provide that server's IP address in place of 127.0.0.1."
How would I enter multiple servers/IP addresses to connect to?
But I want to be able to list the available servers/worlds players can join?
If you want to show something like a server browser, then you'll need to do a session search, which will populate your servers that are hosting sessions.
to clarify
the player does the session search
Sorry new to the whole server/multiplayer thing.
each server that has an active session that matches your search params, will send back a result
Interesting, looks like i need to do some researching. thanks
no problem.
@twin juniper the basic workflow is:
-
Dedicated server creates a session using the online subsystem of your choice, sets a server name, max players and so on
-
Client runs a search for sessions using the same subsystem, with appropriate parameters
-
Once the search is complete, the client receives a list of search results, which contain info like the server name, ping in ms etc, so it can be displayed in a menu if you like
-
Client calls JoinSession using the subsystem, passing in one of the search results, to join that server
-
Once successfully joined, client travels to the server url using client travel
I feel like im missing steps from what youve told me.
The dedicated server creates a session...
The player client asks for other sessions...
But where do these other sessions come from?
the online subsystem
for example, Steam has an online subsystem which can host sessions on steams backend. Steam games have a specific steamappid, which you set in your config files. You can then browse for those sessions in your game. Ignore the red as i'm on an internal build atm, but this is an example of what that can look like:
But I have to set up the extra sessions in the backend right?
And say that my sessions consist of 2500 player slots, wouldnt i need multiple servers then?
depends on what u mean by that?
do u mean the thing that manages the sessions or
Like each game world has 2500 players max
๐
*if
Well if gamelift is scalable im sure its possible?
2500 players on a server is a lot
Wdym? I thought the exampke you showed is one server with two sessions?
So then back to my first question i guess? how would one set up multiple servers?
๐
Through a service or build your own infrastructure for it
No but i mean, back to where it says 127.0.0.1 is one server, how would iadd in all the other servers?
you just enter the IP of the server you want to connect to
You said that i dont, but in this case its different?
Not connecting to, but listing through a server browser, is what i meant
you're looking for sessions, not servers then
Is it not the same thing as you just said 1 session per server?
a server is basically the game server
a session is something that you can search to find the session
give this a read: https://docs.unrealengine.com/4.26/en-US/ProgrammingAndScripting/Online/
Okay i will... but i dont think it answers my question.
My question is seemingly not difficult? I just mean how to connect to dofferent servers/ip addresses instead of the one
hey how can I set the cull distance to disappear players with distance and appear again?
And you suggested sessions, which you said one server per one session, but im looking for a list of multiple dedicated servers?
Then you are looking for a session list. You need to perform a session search and then join the selected session. That will connect you to the server.
Net cull distance?
Right. But how does that work, would i set up the sessions in the aws backend?
yeah, but if they disappear and enter into the distance again they stay invisible
No. Each instance of your server hosts its own session. Session search finds those and returns a list of session that matches the parameters.
Thats weird.
So its practically automatic..?
you need to initiate the search and display the results
Well, thanks.
no problem
Ehhh i have one more question but, it should be rather simple?@fading birch
shoot
How exactly does it work, how does a server instance connect to UE?
No.
Under the hood when you join a session you've found via a session search, you get the IP of that server. You then connect to it via open IP:PORT
that's handled in the engine itself
using the console menu in game to open IP:PORT will do the same thing
but you won't join that server's session
you'll still connect to it though
Ehmm... okay? Lol
the flow goes:
1. Server boots up
2. Game Instance on server starts hosting a session, this registers it with the online subsystem's backend, Steam, EOS, etc
3. Client boots up game
4. Client executes a Find Session (session search)
5. The online subsystem's backend, Steam, EOS, etc, returns a list of available sessions that match your search parameters.
6. The client is displayed a list of sessions (you need to hook this up via widgets).
7. The client clicks a session in the list and clicks a join button.
8. The client attempts to join the session, if successful, it will then travel to the server.
9. When a client joins the server, the player is registered in the online subsystem's backend via RegisterPlayer
10. Normal gameplay loop```
I have a question, I want to change the collision to an actor:
- The actor in question have the replication option turned on
- From the player client I make a RPC to the server to change the collision of the object
Is that ok? Because my clients don't update the collision
This is the blueprints to deactivate the collisions
It's called from the server after it spawns the objects I want to change
hey friends
coming from inhouse engine/networking dev, I'm curious if UE inbuilt networking can be used for server-to-server communications? Replicating actors cross servers/RPCs and such
sad
It's honestly not very hard to implement yourself
Serialize your data, open a socket, send the data
Well, I know how to implement it from scratch
you would need to setup a master server for it to handle the communications. UE4 at it's core was built for FPS games and branched out from there
Multi-Server stuff is usually the realm of MMO's and/or large scale - which often will need it's own backend support.
There isn't any need for master servers if your two servers know their own addresses. Literally open a socket, serialize actor, write to socket.
Yeah, well, that's exactly my background, but I've never worked with UE, thus wanted to quickly check the boundaries of the current system, to learn how much would have to be done by hand if I venture into doing anything in it, after seeing new rendering and streaming tech
Well, mostly Unreal is a client/server model meant for fast-paced games with up to 50/100 players, with dedi or listen server, and that's about it. There really isn't much more than that.
There are different strategies for doing more - using some third party net stack, using Unreal as a client only, or doing whatever Rare is doing in Sea of Thieves with server migration
@lusty badgerYour multicast is pointless. You're spawning something on the server, and then making a multicast to everything, and telling them all to check if they're the server, and if not do nothing, if they are, set collision. Why not just set the collision right after spawning without the multicast?
I have a question about multiplayer. If you make a game without multiplayer, can you still add it?
Like if I made an fps game and I finished it, can I add multiplayer like how Call of Duty is?
would be hard as it is completely changes how some game parts work
it is easy to convert multiplayer game to singleplayer, but not other way around.
ok
That's right! I will check it tomorrow
I just started making a fps game following DevSquads Tutorial. Will there be a way to add multiplayer to that? (If anyone knows)
Guys any ideas on how i could store a list of characters in a database ? I was using the VaRest plugin for that,i have a database and a webserver, i was storing my characters as Json files, but for a more complex character structure i don't think that would work, any chances anybody could share some ideas ? thanks in advance
I used relationship tables to store character data. Each user would have a user id. Each user could have X characters. Each character could have Y loadouts. Each loadout consists of 2 weapons, 2 equipment items, a player custom name, and the loadout id. I stored pretty much all of it as ints and just kept a table on the game server of what id matches what. That would then determine what to spawn for the player.
one to many relationships are your best friend in cases like this
did you do anything weird to the input stuff in your controller? Replicated character movement should just work out of the box.
you shouldn't need to do that
just drop player starts in your level
the engine handles that part for you
unless you want to customize it
you should override RestartPlayer in your gamemode to adjust that then
you also need to override a few of the match state functions in your gamestate as well
If I wanted to have a character move along a spline, and have that movement correctly replicated, does anybody know a) whether using the CharacterMovementComponent / FSavedMove stuff is the right approach, and b) where I could find an example that'll help me sort out how to build it?
FSavedMove is indeed the right way to handle network prediction. As for examples... honestly your best bet is to look at the engine code.
Makes sense. Just start from saved move > find references and go from there?
Pretty much. This does exist which will probably help point you in the right direction, but who knows when it was last updated. https://ue4community.wiki/legacy/authoritative-networked-character-movement-ss8pvvmn
Hi! Does anyone know how hard is to make server timers specific for each client? So for example you can leave something building and when you came back, the time elapsed is discounted
Or how would you advice to approach this?
Im thinking on 2 ways, the server has timers specific for each client that are saved on the server side and checked when ever needed.
Or the client saves a timestamp when he left and the server checks thst when he comes to figurate the time elapsed
Have the server store it and use actorbeginoverlap to trigger the update client side.
Just check ROLE_Authority and call the rpc from the server.
@fading birch Thank you very much !
I'm trying to understand the flow of possession and the events that occur. It seems like on multiplayer possession and the event possessed only occur on the server. Correct?
Then it seems like it's reliant that all variables be passed to the owning client. However i do have some interfaces stored as variables I use for abstracting inputs on held objects. i want the player controllers to handle inputs, then those inputs get passed to the interface.
It works on initial load of a map, however If I respawn, destroy pawn and spawn in a new pawn asigning owner to the selected character controller, it spawns in on the server, possess event occurs on the server, interfaces are assigned on the server. However they are not replicated to the client.
So my question would be are interfaces not replicated even if set to replicate? I'd assume the reference would still get passed.
Does your controller implement the interface?
the pawn gets an object, weapon, etc that implements the interface
So its an input interface, for 16 buttons/8 axis. It's implement on the weapons or other equipment. Pawn itself, implements the interface which just calls to that items interface which actually implents the functionality. The controller gets the actual inputs and calls to the interface on the Pawn which then travels down the line.
So when you spawn in, you get the pawn, which you find its interface, which then would be driven by the actual inputs on the player controller.
Okay I solved it with a repnotify on an object.
object gets cast to the interface.
in the repnotify
playerstate lifetime is volatile and is destroyed when player connects and disconnects
yes
even setting the persist option on them just copies data, new ones are still spawned or destroyed.
i spent hours trying to control the lifetime of them and just ended up just making an actor during prelogin and its never destroyed just stored in a tmap for reuse
in my game these actors are the owner of player owned assets, so even when the player is disconnected the owner is held, so when player reconnects, the gamemode tells the actor the new PlayerController is owner, and walah all of the assets rpcs work again
he will say that wont work well guess what, i did and it works lmao
it was one of heavy attacks that clapped him
Anyone worked with PlayFab dedicated server?
No, but I can probably give you some info as I've done some research on them. Whats up @kind ember
I got server deployed and healthy.
Set the server to active.
But nothing happen when I tried connecting to the server "open 123.123.123.123:7777" and "open 123.123.123.123"
Does playfab make you specify which ports need to be allowed?
It gave me option to pick UDP which I did. But does not let me specify. Just UDP.
i'm not sure if you can connect to it directly actually
via open ip:port
you may need to use playfab's service to connect to it
which seems weird
As long as the server is active, which can be set to active by using RequestMultiPlayerServer api, this api also return server info ip and port.
Matchmaking also return ip and port.
And client uses ip and port to connect according to thier doc, maybe I am missing somthing or port is closed.
This has been a headache.
unfortunately, this is outside of my expertise. Google isn't really helping much either. Maybe contact playfab support?
So the server is running outside of your home network correct?
All good, I am close to getting it to work, thxs
Ah yes, so it is definitely a pain in the ass for this. It's been a long time for me but yes first your port is going to be an issue. Can you ping it from on your network?
through command prompt?
Never tried pinging. Is what do you mean, in cmd prompt?
But I am about to find out by connecting to a PC with opened port.
The project is dedicated server, no peer to peer, so could be port issue.
like on your computer, run windows command prompt, try and ping server.
whats the cmd syntax for that?
it would be like ping 111.111.111.111
i'm not sure if you can put in a port exactly, but yeah first steps see if you can reach it
you should be able to ping the ip. Port is just for ue4
you can via telnet
XD i'm too slow to say that
yeah telnet <ip> <port> so telnet 111.111.111.111 5000
in command prompt
Synology Knowledge Center provides you with answers to frequently asked questions, troubleshooting steps, software tutorials, and all the technical documentation you may need.
I just tried ping target's ipv4 "ping 123.123.123" and "ping 123.123.123:7777" both gave time out but port 7777 udp is open
ipv4 should the one right?
There are 4 sets of numbers for IP addresses
also that's weird your ip is 123.123.123.123
that sounds like a place holder, but it is a valid ip
syntactically
Which of these? I tried ipv4
ipv4
try telnet
look in the link i shared
I'm out for the night o7
or morning....it is that time XD
Cool, will try, thank you.
Lol, was pinging the wrong ip, my ipv4 and external are different.
Pinging external ip worked.
Though telnet isn't able to connect, the cmd prompt "ping" works
Now waiting for engine copy paste to finish so I can test.
Can someone remind me what Event is called on a PlayerController, locally, for both new and seamlesstravel controllers?
Need some common entry point. Freaking BeginPlay..
Actually, BeginPlay works for Local Players, but not for the Server. Great times.
what are you trying to do?
you have HandleStartingNewPlayer in GameMode
that is usually a common thread between the two, but all "construction" events will get called, ending with BeginPlay
Yeah, I use that to init my UI. But the UI needs the GameState and that is invalid on Clients at that point.
I made myself a callback now to listen to so I don't have to weirdly query the GameState
no actor on client will call BeginPlay without a GameState
and you can do before BeginPlay easy enough
AGameState::PostNetInit, as a simple solution
which is the first point you will have replicated data in GS available on clients
Right, sorted it now
Hello, currently developing a rapid fire weapon in multiplayer, and im getting server lag when firing due to it multi casting every 0.2 seconds, is there a better option?
What are you multicasting for?
What I usually do is:
HandleFiring on Server and Client at the same time.
Increment an Integer whenever the Weapon is fired.
Make that Integer OnRep.
When the Weapon stops firing, set the integer to 0.
In the OnRep, check if == 0 and stop effects
In the OnRep, check if > 0 and Perform Simulated Shot. You can also Start looping effects here if the previous integer value was 0.
The OnRep should not run on Authority or LocalClient. It only simulates the weapon shot.
// Executes on Server OR Owning Client
void TryStartFireWeapon()
{
StartFireWeapon();
if (!HasAuthority())
{
ServerRPCFire();
}
}
// Executes on Server
void ServerRPCTryFire()
{
TryStartFireWeapon();
}
// Executes on Server and Owning Client
void StartFireWeapon()
{
// Start Looping VFX/SFX
FireWeapon();
}
// Executes on Server OR Owning Client
void TryStopFireWeapon()
{
// Same as TryStartFireWeapon but with Stop
}
// Executes on Server and Owning Client
void StopFireWeapon()
{
// Stop Looing VFX/SFX
}
// Executes on Server and Owning Client
void FireWeapon()
{
if (HasAuthority())
{
CurrentShots++;
}
PerformWeaponTrace();
}
// Executes on Everyone
void PerformWeaponTrace()
{
// Trace
// Handle VFX/SFX
if (HasAuthority())
{
// Handle Damge
}
}
// Executes on Simulated Clients
void OnRep_CurrentShots(int32 PrevCurrentShots)
{
if (IsLocallyControlled())
return;
if (PrevCurrentShots == 0 && CurrentShots > 0)
{
// Start Looping VFX/SFX
}
else if (PrevCurrentShots > 0 && CurrentShots == 0)
{
// Stop Looping VFX/SFX
}
if (CurrentShots > 0)
{
PerformWeaponTrace();
}
}
Yoooooooooooooooo
Why not a snippet Discord
Why not
Haha, thank you for the help! I am using blueprint but can read code somewhat, so ill break this down!
It's not 100% code
It's just pseudo code
So should be simple. If you use BPs, you won't have access to the PrevCurrentShots in the OnRep, but I'm sure you'll find a work around
ah alright, yeah i am sure i will figure it out somehow!
Quick question please. If I have a regular actor that is set to replicate, when I run functions on that actor, do the functions automatically run on the server or I have to explicitly mark the function to RunOnServer?
You normally mark an event as "Run On Server" when you're trying to call the server from the client (Eg.
You click a button on your client -> Run On Server Event -> Server does something). This will also only work on actors that are owned by the client.
Events that are not marked will fire from wherever they are called. So if they are called while you are currently running on server, they'll run only on the server. Eg. "Begin Play" fires on both the client and server. If you had a "Switch Authority" and took the "Authority" path, then you're running only on the server and if you called an event on that path that doesn't specifically indicate what it should run on, then it would only run on the server.
Thank you
Does anyone here have experience implementing ok mulitplayer netcode in large maps (> 10km^2) in unreal multiplayer (multiplayer origin shifting)?
I am interested in making a flying multiplayer game and hoping someone has some experience to share.
It works, sort of - so long as you account for it everywhere
Server is always using zero-origin space though, it's only clients who can rebase
Which also means it's not an option for listen servers
Which also means that server calculations will have inaccuracies and clients will need to account for that
Hey guys, when I try moving with a Client, it stutters and shakes like crazy, while when I move with the Server, it is much less so. Anybody know why this is? Even if I remove my Animation Blueprint completely and just have standard A-pose movement it still does it.
Evening everyone, I have one large variable that i want to replicated from the host to clients when they join the session, RPCs dont work since im guessing its to big? Anyone smart that has a solution to sending that? ๐
You can use a gamemode since it only runs code on the server/host to store the variable that you want to replicate. it also has an "OnPostLogin" event that you can use to run code whenever a new player joins. So off of this event you can use that variable to call whatever events you want on your player that just joined.
Aha, so if i save it on the host in runtime to the game instance the client will get the saved variable when it loads into the game session?
Game instance is another thing. game mode is what you want to save the variable on. It wont load the variable automatically but whenever your player joins, it will fire off the OnPostLogin. from there you set whatever variables you want on the player that joined.
another thing you should look into for syncing data when a new player joins is "RepNotify". It will run a function whenever a variable is replicated, so it gets called whenever the player spawns
Ah! yeah i have used repnotify for it but from the player controller so it failed, Super thanks for the help!
How are you moving your client?
@fading birch Just standard character movement component
with regular input? interesting
Yup
have you changed anything about net updates in your .ini?
No I havenโt
are you replicating your skeletalmeshcomponent or are you replicating any owning client predicted updates back to the owner?
Hi, I'm running a Multicast RPC from a pawn, and I'd like to run a function only on a single player character, rather than replicating to all characters. How can I go about this?
I did that, but it didn't seem to work, this code is running only on the server, is the collision setting automatically replicated?
Ok, I fixed it! I call a repnotify variable on the item from the server that set the collision in all the instances, now it works!
@winged badger Can you elaborate? I have never done anything with prediction so I doubt I'm doing that
you never replicate locations, rotations, etc... to a client that RPCed them to the server in the first place
replication condition SkipOwner if you're doing that
its more likely ComponentReplicates ticked on SkeletalMesh though
ComponentReplicates is not ticked on the mesh
Not sure if this information helps, but if I walk forward there is no stuttering like in the gif. Only if I walk left, right, or backwards
Hi! any way to quickly mockup a dedicated server to load/save profiles between accounts?
How do you guys deal with the delay in the projectile spawning on the client
I am trying to spawn projectiles from my gun on the server
and they're quite a bit far ahead already when they appear on the client
is there a good way to make player movement server side (i mean asking the server to confirm that the player can do it.), like move forward, right etc
Or the movement component from Third Person Template already manage that ?
CharacterMovementComponent handles prediction and correction for you
Do you want to get rid of prediction (client-side simulates the movement first) or just asking if server confirms (after every server update, server checks the clients position based on the velocity and checks if its possible that client be there, if not, corrects the movement) the clients movement?
Would this work in multiplayer?
does anyone know a function to check if level is multiplayer or single player
its for a branch in my pause menu
if it is sp it will call the pause game function and bring up pause menu
if it is multiplayer it willl not pause game but will still bring up pause menu
the world has a net driver, and in it is a NetMode
GetWorld()->GetNetDriver()->GetNetMode()
Does anyone here use EOS? I integrated it into my project and so far it's working. However once I try to host a dedicated server on a remote windows PC I get an SSL Certificate issue. However on my dev PC it runs without an issue. Both systems have no additional SSL certificate.
What are they referring to?
As Epics support is as bad as always my question gets even deleted without a comment from the EOS Forum ....
Any idea what this issue could be?
@snow thorn There isn't one by default I don't believe. If you're not opposed to C++ You can basically make a function that does two checks. First is if the net mode is client. If it's not a client. Then you can iterate over all playerstates in the gamestate and check if there is more than one playerstate that is a player's playerstate. Easily done via !PlayerStatePointer->IsABot()
I have this simple widget which has 2 progress bars for health and armour. I have a health and armour variable on the character, both have rep notify functions. But for some reason clients cannot see the bars being filled/changed.
https://cdn.discordapp.com/attachments/663019057166942238/852852915256557568/unknown.png
https://cdn.discordapp.com/attachments/663019057166942238/852852652412895232/unknown.png
Any ideas?
Hmm, trying to use UnrealInsights on my dedicated server to see where my memory costs are coming from, but I can't seem to actually find the data anywhere.
Has anyone used the tool for this purpose before? I can connect and all, and it says the module is active
I seem to only have these tabs
@young spokeYour Onrep looks fine initially. Put prints in. Make sure the OnRep is running on the client.
Solution โญ
Hi! does anyone know if there's an easy way to put a test server? i want to test things like login, data saving on the server and functions running on the server when the user is logged off.
How to set up and package a dedicated server for your project.
i can only setup a dedicated server for my project if it's on cpp? o.O
i'm doing something like travian, where a lot of people connect to the same server. Not sure if a listen server will work, what do you think? i'm extremely new to multiplayer and i'm looking for what are the best ways to implement it
I haven't done it before, but that CPP looks pretty straight forward.
i'm not sure if for CPP project it means to just initialize the ccp class or have it all full CPP with no BP D:
I see. It looks like it's just the server that uses that C++ setup and once you have that you can compile the server. But I really shouldn't be talking about it because I have no idea. I'll be looking into that soon enough myself though. I'm playing with listen as we speak (and running into a little issue).
As soon as my second PC character spawns in, they disappear (and make their own instance it looks like). Not sure what's going on there yet.
Yeah, I'm not sure what's going on with my setup. Sometimes the second player disappears and sometimes he stays. I'll get to the bottom of it.
Hi all, when calling SessionInterface->UpdateSessions and passing in some new session settings, do I need to pass in ALL of the settings, or can I only pass in the ones I want to change? For example, if all I want to do is change the name of the map, can I create a new session settings with only the SETTING_MAPNAME defined, or do I need to redefine everything like player limit, whether it should advertise, if it's a presence server and so on
One quick question, i'm reading the documentation of UE4 on multiplayer, but i don't see anything to limit the scope of how much something is being replicated on each client, like a LOD.
for example:
on a mmorpg, you don't want to replicate on player1 what is happening to player2 unless it's near enough to be relevant.
anyone knows on where i can look more into that?
@fluid summit For an MMORPG I would look into the replication graph, it is a more efficient way of handling relevancy for potentially thousands of objects
not doing a MMORPG just in this case, but i tought it was a good example.
i'm gonna need to have a shared map, but i want to limit what is updating on the map with some criteria.
I'm gonna look into replication graph, thanks!.
Relevancy is the concept of "lodding" in UE4
Relevance and Priority
Relevance is used to determine whether or not it is worthwhile to replicate an Actor during a multiplayer game. Actors that are not considered relevant are culled during replication. This saves bandwidth so that Actors that are relevant can replicate more efficiently. If an Actor is not owned by any players and not physically near any players, then it is not considered relevant and does not replicate. Non-relevant Actors still exist on the server and can affect the authoritative game state, but do not send information to clients until players are nearby. You can manually control relevance by overriding the IsNetRelevantFor function, and you can determine the distance at which an Actor is relevant using the NetCullDistanceSquared property.
Sometimes there is not enough bandwidth available to replicate all relevant Actors during a single frame of gameplay. Actors therefore have a Priority value which determines which Actors get to replicate first. By default, Pawns and PlayerControllers have a NetPriority of 3.0, which makes them the highest-priority Actors in a game, while base Actors have a NetPriority of 1.0. The longer that an Actor goes without being replicated successfully, the higher its priority will get with each successive pass until it is replicated.
For more detailed information about Actors' relevance and priority, refer to our guide on Net Priority.
but it's more about completely culling, not lowering "detail" as such
it seems i just needed to read a litle bit more jaja
@fluid summit On a side note to your earlier point about the C++ project. Any serious project will be C++ and Blueprint mixed. Even the absolute most hardcore C++ people still make use of BP child class data only blueprints for setting default values.
Yeah, another question.
let's suppose i want to have one variable HP that increases by 1 each 5 seconds you are playing.
but i want it to increase even when the player is logged off.
how would you implement something like that?
i'm thinking on update it only on demand and on each update check the last time of update vs the current time and in this case, divide by 5.
any other good way?
Sounds like a pretty classic case of Replication to me. On Server, just have a timer or tick function that handles your health update. Only ever set the value when it changes every 5 seconds. If the client isn't logged on, nothing happens to them but it still updates on the server. If they are logged on, it replicates to them.
do you think that would be too costfull? let's say you have 1k players (just for sake of the example)
and all of them are logged off, the server will have to update 1k set of variables every 5 secs.
is it really cheap since it is updated only on the server and no bandwith is required?
I mean.. you're talking about setting 1k values once every 5 seconds. Assuming no one is logged on, there is no replication. So at that point it's just a computer setting 1k values in a frame. that happens once every 150-300 frames. If your server chokes on that, it needs replaced. ๐
That is really nice to heard jajaj
What you won't like hearing is that that kind of scope is unrealistic.
No game actually has 1k people on the same server. For that kind of thing you're looking at major outside infrastructure. Even major MMOs, which refer to their individual worlds as "Servers" are kind of misusing that. What they actually are are several different servers working together to create one world, likely with a main, very simplified overlord that manages them.
And when I say no game, I mean this from any standpoint, not just UE4
I mean. Maybe it might be possible with some very slow strategy style game where things are slow enough to be updated very carefully over the course of many seconds and the server can send updates to connected clients, and you put in that framework to handle it.
Oh Yeah, i got that. For this project im aiming at Most for a dedicated server that allows for 15/20 players at Most, it's mainly to learn and to get a game wish out of my head
Even for a game like travian where you only need to update Flat values?
example would be like bungeecord/waterfall for minecraft
thats how they get those crazy 100k plus player counts
For some reason my new blueprints no longer multicast correctly
I am calling multicast functions from the server, and it is only running my multicast on the server
does anyone know what would cause this?
I've confirmed that it is actually running from the server so that's not the problem, and it is set to reliable
what BP are you calling the multicast in? if its a BP that only exists on the server, like gamemode, then only the server would run it, since it doesnt exist on the clients
Not seen much about, but is it possible to dynamically increase/decrease update rates for network
for replicated actors?
ie actors moving far away from a target have a lower net update freq
wondering if just changing the netupdate freq would work
it is just an actor that extends the base actor class, here are the replication settings
how do you know the multicast is not working?
who is calling the multicast? client or server?
(only server can invoke a multicast event)
. . .
so.. whats wrong/
print on tick of that actor if its replicated
maybe you have done something that turns it off
oh replicated to the multicast event? Sorry I am a bit confused
like this
riight
okay
It calls on all for things like Beginplay and OnRep but not multicasts
and I have no idea what's wrong lol
strange
right?
multicast is reliable?
yep
not called on tick?
not sure why memory game calls a netmulticast
cause that would not work
cause its comes from a OnRep
which is run on clients
I thought onrep also runs on server?
but even if I call show colors from my beginplay it doesn't multicast
ah its gated
but feels a bad design choice tho
what if you make a new funciton
and call that does it work? i have had issues where bp gets a bit screwed up
and looks like you are making the memory game from CoD zombies Moon Easter Egg 
heh, anyway, try a new function
