#multiplayer
1 messages Β· Page 666 of 1
Oh? Thanks man
Unfortunately what I'm looking for specifically isn't there.
Glen Fiddler discussed it in his series of blog posts but I was looking for actual code implementation.
I'm messing around with a server meshing system and was looking for help.
God, I'm slow.
Now that I think about it, you were being sarcastic, weren't you?
Ah, I see... Sorry about thatπ
In a game Im starting to make, I want multiplayer to be implemented from the beginning. After looking at the options, I want to make it support both p2p and dedicated configurations(for something like Gamelift or AWS) and possibly even listen servers. Can that be done? I read that ue4 will take a lot of extra work to support p2p as it has a client/server model at core. But EOS has a p2p option?
But aren't a lot of AAA games p2p at least partially? And there also seems to be no other way lower cost, if the kind of game itself is the main constraint.
Unreal doesn't do true P2P
Listen server is the closest way
EOS or not EOS has nothing to do with it at all
what about steamworks p2p, is that any good?
also can it be integrated easily
i know that it relays all traffic through their own servers. i think @twin juniper called direct p2p nightmare tier because of NAT issues?
so can i use steams multiplayer service in ue4 and also keep the option of dedicated server open?
i just read that steams service is only for matchmaking , achievements etc. not for gameplay
so its like EOS i guess
So if i write a listen server, can i also run it as a dedicated server on AWS, or gamelift?
ah that would be a good idea, lan parties and such
So listen server isnt a separate process. But what does this, from a previous post mean? :
switching between dedicated and listen isn't particularly hard. If you're writing things that don't assume the server has a player (you shouldn't do this anyway) it's incredibly easy to test both dedicated and listen servers.
"dont assume that server has a player?"
alrite will do
What multiplayer service ?
Steam just gives you matchmaking
It gives no shit about your multiplayer infrastructure
It doesn't host servers
It doesn't provide netcode
It gives you sockets, which you'll use with dedis or without, it doesn't really mater, though they're useful for competitive gampelay in P2P, which you can't do with Unreal
Your choice is dedi server (competitive game, >5 players) vs listen server (not competitive, <=5 players) AND Steam vs EGS vs GOG vs PSN vs idk
These choices are completely independent
that means i can only choose dedi then π© . for dedi i think there is another choice to be made? aws/azure or playfab/gamelift
Nothing but i'm working on a crouch feature in a competitive game and we can't drop a packet on this feature especially when i'm polling at a low hertz
If the crouch is an analog axis (why ?) then yeah it needs unreliable
That's kind of the way it is imho
If it's a boolean action, make it reliable
a hard switch action ftw 
And replicated variable would be the usual way to communicate this
Any1 have any insight to my issue?
what is the proper/good way to replicate animtion ?
you can google this question for more suggestions.
https://www.youtube.com/watch?v=zZWc-WUafXM&ab_channel=Uisco
In this tutorial I go over how set up animations that can be replicated in multiplayer in 2 minutes. In this video we set up a simple emote system when the character presses the emote button he will do his animation and this can be seen in multiplayer as well.
How To Add Custom Character : https://youtu.be/WW7cXj_Cksw
Join the discord : https:...
i thought about it again, dedicated server is a high price to pay for competitve gaming and leaderboards. Can i use listen servers and matchmaking through steam or EOS for everybody ? And shadow ban cheaters?
it would still want it to be competitive though.
you would never use listen servers for anything designed to be competitive
the host player will have an advantage, even without the ability to cheat
the steam and EOS p2p is basically listen servers with NAT punchthrough, you would still have a host
since UE4 only supports client/server model
yea i learnt that. its a tough world for indie multiplayer it seems βΉοΈ
you can't make a competitive multiplayer game on a shoestring budget
or by the sounds of it, no budget at all
hello, do somebody knows why "InteractClient" is not working ?
how to make pubg match making system in depth ? "for mobile development"
So since everyone talking about both UT and ShooterGame is outdated, anyone knows where can we find examples of latest patterns?
Not talking about Unreal Engine specific
For example Jambax has a great article for a better burst counter: https://jambax.co.uk/better-burst-counters/
Hi guys, I have a noob question to ask about about a weird bug I've been having in my own project regarding multiplayer
When I click play, all clients are frozen in the air, they receive inputs just fine and are able to look around, it's just that physics don't seem to work. Only clients face this issue, the listen server is able to walk around just fine.
I have a very basic custom Player Controller, and a basic custom Character that the Player Controller possesses.
Is there a setting that I'm meant to turn on to let my character replicate gravity or something? This bug is very strange to me, because the default PlayerController possessing my custom Character allows him to fall normally
as for UE4 everything is going in the direction of GAS... but if you want to check state of the art goodies, take a look at the network prediction plugin
Yeah seems like GAS and such 'gameplay' modules/patterns are getting unavoidable if you want to follow Epic's way
Thanks
would a bpi be the best way to handle a player dying in a pvp game?
Soβ¦ I have a question for the Advance Session Plugin users- How do I get all currently connected players in the session? (pls ping so I can see the message) And thank you in advance π
Maybe the actor was created/replicated to the client accidentally before.
Do you use a 3rd party solution for that? I'm looking into options to save (player) state locally (maybe with savegame or a local copy of a data server) & remotely.
Anywhere I look I read that to make a real multiplayer game you NEED to go with C++ because of performance issues. What's the basis on this? Has anyone really tried doing it and realized they have to switch to C++?
I'm thinking of making a prototype 6v6 round-based multiplayer game and I'm thinking about learning C++ further or just do it in BP.
@lime skiffNope, the owning actor has always been the inventory system actor (ARaevinInventorySystem) and it always has had the bLoadNetClient = false set in the constructor
No I am building my own backend service with .NET Core to power the WebAPI and a mixture of other tech to push the data into the oracle database
why do you believe this? you can poll the analog axis and interp w a reliable rep notify
simple question.
How come I run this BP code and the nothing happens?
Neither the client nor server travel to the map defined.
and running this makes only the SERVER travel to the new map:
I've got seamless travel enabled too
I want to start creating Unit Test for my game using the Functional Test actors. How would you go about running a test under a scenario where there is a dedicated game server and at least one client?
I've got more of a general question. The easiest way for me to handle a tree falling over and destroying what it lands on is to do line traces. So the server would be doing these traces and only sending when a result was found, right? Like server-side the tree might fall on a player and when it does it sends that update to everyone else. Is that too heavy?
better to do a sweep with a cylinder
and you can RPC the hit results to clients, its fine
how am I supposed to create references to things like game modes or player states?
this ?
I did that but it says it's not compatible
what do you want to do with this ?
where is that node located ?
the target can only be gamemode then
so how am I supposed to message my player state to update what team the player is on?
can you show me the nodes from "join team" ?
Could some one help pls? ^^^^
this is in my player state bp
can you find something if you search ps test like here ?
yeah I already tried to cast and that just failed
did you set your player state class in the gamemode ?
because that's why is giving me fail on the cast
you're welcome
can somebody help me with this ?
@woeful lantern My first guess would be ownership. This looks like a chest like container or something. Client needs to have ownership to call RPCs
can I change the player name in blueprint or is that just c++?
*through a player state
@elder sage you need to cast to your custom PS type there
it's a lever, how i can make the clients to have ownership ?
that is just APlayerState reference, not APSTest
You shouldn't. Have your character or playercontroller call a default interact interface function on the item from a server RPC from the character or controller, the interaction function can be implemented in the lever and called on server.
By default a client only owns their PlayerController and PlayerState, and whatever pawn their controller has possessed. So usually these can be used to call basic interactions with the world through server RPCs and then state replicated back.
so i should do the repilcation on the character ?
thx
I have a problem regarding a cancel connection button when I press the button I destroy the session but that doesnt cancel the connection so I have to load the menu level but the problem is when I go back to menu it resets my widgets and I dont want that. I want to when I cancel connection to remain in the server selection widget. Is there another way to cancel connection without having to "open level"
Did you solve the problem? I'm blocked on same problem π
Introduction Hi, Iβm Glenn Fiedler and welcome to the first article in Networked Physics.
In this article series weβre going to network a physics simulation three different ways: deterministic lockstep, snapshot interpolation and state synchronization.
But before we get to this, letβs spend some time exploring the physics simulation weβre going ...
Oh, super fast reply. Thanks i will read it right now π
I'm having trouble figuring out what i need to do to update the scoreboard for everyone in the match
it only updates for the one who dies, whether it's client or server
I know that it's because I put the "update score" logic following my health/death check, but where should I put it to avoid this?
I now have it to a point where I can go from my game mode, because that's where I decide what scoring to give, to each player's widget
There's GameState for that
how do i connect to a mysql database?
@steel fox I read all that articles. My conclusion is to replicate the input of the object (the booleans like move forward, move backward, turn left, turn right) with RPC. What was your conclusion? π
Mine was to replicate Location and Rotation from the simulated object owner to everyone else and correct it there(with VInterpTo and RInterpTo you can do a smooth correction), this way you avoid input lag
With Multicast RPC? Doesn't it occur performance problem?
Else you can set the variable to replicated and update it through Server RPCs, use FVector_NetQuantize and of course, if you have many posessable pawns update it only when needed, for a few players I think it should be ok
How long was the RPC's interval? Sorry for many question π
I mean, in your case
I've tested it with 50 updates per second and it was fine, tried simulating network lag and somehow it worked but the corrections were obvious, I think you can find the ideal updates per second for your case doing some testing in different network conditions -> https://www.unrealengine.com/en-US/blog/finding-network-based-exploits
Recently, I had an email conversation with a Gears of War fan about the differences in networking quality between each of the three games in the series. One thing that we can point to in terms of increasing the quality of the networking experience is our use of the Unreal Engineβs built in network simulation features.
Thanks a lot. It really helps me π
There already is one, AGameStateBase::PlayerArray
Contains a list of all active player states in the game
Is replication data sent out to all connected players in the same tick?
for Replicated variables
It'll be sent on the next network frame, which is (usually) the last thing to happen in each frame - IF that actor is compared that frame
Whether they receive it or not depends on networking
hello guys so today i started my first ever multiplayer game so i followed this tutorial to add Amazon Gamelift
https://youtu.be/PIg2q0wEPJc
so i installed UE 4.26.2, did all the steps which shown in the video but iam getting this error "Server targets are not currently supported from this engine distribution."
Watch Part 1 here: https://youtu.be/tOy0xYaP3wA
This video is the second part of an extensive and informative tutorial on how to integrate Amazon GameLift with Unreal Engine, going over concepts such as building the GameLift Server SDK library files, adding the GameLift Server SDK plugin to a UE4 project, and packaging a Unreal Engine dedicated...
can any one know what happen exatly?
this is my output guys
@twin juniper you can't package server without source version of the engine
what you mean i didnt get u @empty axle
You didnβt make a Server target.cs file
Itβs in your error output
Open up the documentation above and go through step 2 again. There is an issue on how you set that step up or you missed it
ya its with same steps
even if i build this code from vs by selecting development server also iam getting this error
copy and paste your GameNameServer.Target.cs into chat please
I know you definitely are using a source build since you would not have gotten that far without one
// Copyright Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;
using System.Collections.Generic;
[SupportedPlatforms(UnrealPlatformClass.Server)]
public class Amazon_GameLiftServerTarget : TargetRules
{
public Amazon_GameLiftServerTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Server;
DefaultBuildSettings = BuildSettingsVersion.V2;
ExtraModuleNames.Add("Amazon_GameLift");
}
}
Are you sure they are using the Source Build?
Did you maybe forget to actually assign the Source Build to the Project?
Amazon_GameLiftServer.Target.cs
The error is quite clear
source build?
I'm thinking he wouldnt have been able to get that far if he wasnt using a source build
You can't build Dedicated Servers with the Launcher Version
You need the one from GitHub
That you have to build yourself
And then switch the Project to use that
Try this - Close out of your project right, right click your gamename.uproject and then click switch engine version
and whatever is defaulted in that box would be what its opening up on
It should say Binary/Source build located at "...source build location"
ya so i used from epic launcher opened ue 4.26 created one new project and i started doing this tutorial above
Follow that step I just put above that last message
this? @royal sparrow
If it looks like this, you are using a source build. If it says 4.26/4.27 you are not
Yes
so you are not using source build engine
^
it's the first requirement in the doc that I sent
ya
Click the dropdown and see if you have an option like my screenshot shows
but i thought both are same
so now i have to download engine from git and do same? right
no i didnt have
If you haven't already then yes. Download the engine from git and then build it
ok
after downloading same like right click on .uproject file and select version and select source version?
I misunderstood you earlier. I thought you did this already. This is the first step. Pro tip, I just download the releases since its faster imo then pulling their whole repo into git
You have to build the engine first and then yhou can select the source
Just make sure you follow the instructions in the readme. I've built the engine quite a few times and I believe it is something like this(should still read the readme).
- Clone or download repo
- Run setup.bat
- Run GenerateProjectfiles.bat
- Open UE4.sln
- Build project
what about the project which i just did all the things like coding and all
no use?
and also which source i have to download i can see 10 repos here
There is one called UnrealEngine
first one?
Not sure, don't have my phone to mfa login. It should just straight up be UnrealEngine.
Almost identical if memory serves corerct
this one?
perfect. Alright, thats the repo. Follow the instructions in the readme and you should be up and running soonish depending on your computer. My dev computer builds it in 15-20 min and my test pc builds it in about 5 hours lol
What version is your game using?
4.26
Is there any way to disable linear smoothing for simulated clients?
https://gyazo.com/dfead7b56abc659d1a1daf4b4d191724
Currently set the player character to be attached to the horse and send the horse inputs, however on other clients you see him still trying to linear interpolate the velocity
@twin juniper Click "+214 releases" -> scroll down to "4.26.2-release" -> Click assets and then click "Source Code.zip"
I have a simple demo I'm trying to make work: 1) When a player triggers a volume, I want that player to own some actor Prop and 2) I want the client (not server) to be the owner when this happens.
From what I understand, just setting the ownership from the server should work, because the players are by default autonomous proxies, and anything they own will have the same role. Is this true?
To anyone having the same issue as me, answer described by user Talad works:
https://answers.unrealengine.com/questions/790345/attaching-client-to-moving-pawn-annoying-jitter-he.html
I have a problem regarding a cancel connection button when I press the button I destroy the session but that doesnt cancel the connection so I have to load the menu level but the problem is when I go back to menu it resets my widgets and I dont want that. I want to when I cancel connection to remain in the server selection widget. Is there another way to cancel connection without having to "open level"
I am doing a multiplayer event on ListenServer and I should reproduce for all clients some changes to the BP_Sky
I'm trying to start a game from a steam lobby, i start the session but i don't know what i should do to start the game on clients. Should i call a RPC on each players or there is something automatised in UE ?
sup. i'm building a persistent world and i got player inventories (and other stuff) that i wanna save, and obviously this will all need to be set up server side that makes calls to an API.
that being said, for now i don't really need this functionality and instead i can just save player's inventories to hard disk using an unreal archive. how would i go about replicating this to other players? do i just make a bunch of server RPCs when the player connects?
If you set it up within a component on the PlayerState you could have the Client send the initial state of their Inventory to the Server yes.
However this is extremely easy to manipulate.
hello, if i run Set Actor Rotation on the server in a character, shouldn't that issue an update for the client through the replication system?
@fossil spoke only need it to test out gameplay for a vertical slice demo, not a full fledged game. game will have a proper api eventually
thanks for the suggestion, that works
is there a way i could do this on the server? maybe keep the server alive the entire time?
and if the player spawns in again, restore their player state?
Servers can also use the SaveGame system
this just blew my mind, this is true
So if you want to handle it that way.
so i just save all the player states to hard disk!!!!
i've got another question. i need to keep the player's pawn around when they disconnect for a couple of minutes. off the top of your head you have any idea where this would happen? would i be doing this on the game mode?
Im not sure if OnLogout is called before or after the Pawn is destroyed.
You maybe able to unposssess the pawn in this event
Which should stop it from being destroyed.
You may also need to call ForceNetUpdate
Though if your only using Blueprint im not sure this is available.
Generally I think only a change in Velocity causes the Character to update to the Client
we do a launch character before the set actor rotation
i tried the force net udpate and doesnt do anything
set actor location works fine without anything
set actor rotation doesnt do anything
right now the only way i kind of got it to work was making a client rpc
but doesnt trigger every time
It maybe because the PlayerControllers ControlRotation is forcing it back to where the Player is looking, negating the request to set rotation directly.
10 % miss
the use controller yaw is set to false
so it shouldnt use the control rotation
its a third person template
Is it a one time thing?
yes
Odd
i know
i'll show you my simple test
it only rotates in the server
not the client
even with the force net update on the server
Is there something stopping you from setting the Client Rotation as well?
not really, but i wanted the replication system to do that for me to save an rpc
You dont need another RPC.
Just call SetActorRotation before the call to ServerRotate
The Client is predicting that the Server is going to perform the same action.
only the server has the rotation
it's a precalculated thing
that is done on the server
Right so thats why i asked if there was something stopping you from doing that lol
i was answering regarding using an rpc
i can pass the rotator on the rpc
and the client does the rotation
Whats this ultimately achieveing?
it was so we didn't do the processing of getting the rotation on client and the server, but we can try it like that
But are you like trying to move the character in the direction of the Launch?
we're trying to make the character rotate in the direction of the launch (excluding z obviously)
the launch is done on the server
You should be able to calculate that on both by using Velocity.
Velocity is just a Vector pointing in a particular direction, they can be converted to a Rotator.
Both the Client and Server will have the Velocity.
when the player presses the jump key it does an server rpc to launch, so i should only be able to check the velocity after the rpc has been executed because only then will the velocity change, and it should also be a one time thing on the client
Yeah its not an ideal situation. Im unsure why setting the rotation doesnt result in a change on the Client.
How am I supposed to replicate my scores to each player's widget reliably?
Create the "Score" property on the PlayerState (I think it already has one by default).
PlayerStates exist on all Clients.
So where would I put my event to update the score? I'm unsure how to go from the game mode or game state to the player state for each player
I guess I should also say that this is for a pvp scoreboard, so I'd need both individual and team UI stuff
i am somehow not seeing any packetlag and delay with net -pktlag=500 and netemulation.pktlag 500
any ideas?
hey folks, i'm having a bit of an issue with my networking of a simple pong like game. so i have most things working, but one aspect i want is to let the local player control his paddle directly. so for the local pawn i disable replication so it'll ignore server replications, and this seems to work mostly fine. however it seems the proxy does not respect the constraints i have set for the physics object(only movable along the x axis), and when getting hit by a paddle it incorrectly moves the paddle back. any help on how to achieve this behavior correctly?
am i suppose to run the command net pktlag in server only or client?
anyone can clarify?
I use it on both
the correct way should be on client only, right?
i mean does it even make sense to run it on server?
It does make sense
If you're using listen server it will be normal computer too
Host can have lag too
i see, you have a point on listen server
sup fellas. anyone have any good workflows on how to test servers? as in, sure i can launch the server and the client all at once from PIE, but how do i go about launching a server and testing clients individually on it? should i package the server, run it and then run clients or some shit?
seems like a weird workflow because now i have to package the server every time i want to run a test
i guess i could try some configuration options in my IDE using UnrealEditor.exe -Server but idk
i actually i think i'll make a script for this. i'll rebuild my project and then run the script in my configuration. cheers
hello guys so i downloaded source file from git and i did all the steps but after i create one project and if i open it its saying this
what is this exactly guys
how to clear this
What does that have to do with multiplayer
Please ask your question in the right channel, then you'll also get help quicker
so i followed this steps to setup multyplayer
That'll be either #engine-source or #cpp as you are having problems with building the engine
ok
Yeah well turning on your PC is step to build multiplayer. Doesn't make this a hardware channel, does it :D
hahaha
LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor BP_Range_AI_Aggressive_C_2. Function ServerSetCurrentAnimSetting will not be processed.
Any idea what this means? So I'm calling multicast from ServerSetCurrentAnimSetting .
you are calling ServerSetCurrentAnimSetting from client which is not the owner of this actor. Either you make that client an owner of it (if that makes sense) or you route the RPC through something that the client owns like player controller, character, player state
So I've that function in the component of the player
i have 100 players in my game
and i need to sort their positions
where should i do that
on server or client ?
is the component created with player as owner and is it set to replicate?
what do you mean
Yes
those are all requirements, it should work
i mean i have to manage list of players
on basis of the positions
its kind of racing game
server-side unless you have information about all of the players positions client-side and you can create it just locally
and I would lower that 100 players limit in your game to something lower unless you have a whole studio with you
i do need players postions
i just need a variable like coverd distance
from player state and sort the players on the basis of that
yes i am with studio i have to write it down but yeah goal is 100
but first i have to run only 50 players
If it's a race, then it's usually along a path
Which means you usually get that "covered distance" by checking how far along the player is along that path
That path can be a simple spline
You can query the max length of the spline
As well as query the length of the spline relative to a location ( the player )
Then you can sort them by that value
Hey is there a way to replicate this play montage function and also keep the ending outputs like on completed and blend out? I need those for my ability system to tell it to stop the ability once the montage finishes. If I try doing it using it the normal way using a multicast and run on server, it loses the output nodes from the play montage. Does anyone know a solution for this?
Guys to replicate the rotations and avoid jerking is fine like this or you should also apply a multicast to the rotation
hi. currently trying to work out why the tickrate isn't getting clamped for the listen server despite setting this in defaultengine.ini. If you know about this stuff, here's the forum post: https://forums.unrealengine.com/t/clamping-tickrate-for-client-and-listen-server/253110
Hi. I have a multplayer game that is public but still being worked on. There are no dedicated servers as Iβm a blueprint only dev and thatβs beyond me. Listen server is working well for 1v1 but weβve expanded the scope of the game to 2v2. I had thought the server tickrate was clamped at 60fps. however, when 4 players are in the game and the se...
Listen servers are whatever the fps of the host is running at
So U would have to lock their fps
And they would also have to be able to reach that fps
thanks. but have a look at the ini in my thread - i did find some commands that i was pretty sure did successfully clamp it.
which i got from here: https://forums.unrealengine.com/t/multiplayer-lag-if-listen-server-goes-beyond-120fps/143737
Hey, anyone know how to set the character rotation in multiplayer? I want to align the player with a ladder but neither set control rotation not set actor rotation will work.
@gusty lily If you have a maximum tick rate coming from somewhere else, it will I believe override the listen server tick rate.
See UGameEngine::GetMaxTickRate()
The parent implementation may overrule whatever you set
Net tick and game tick are locked for listen servers, AFAIK
But if you've done something like 'SetMaxFPS', that will overrule it AFAIK
Is client side prediction the hardest thing in making a multiplayer game?
Not the hardest but its hard depending on the logic imo
Is there a super easy gas projectile implementation floating around yet or is it still a pretty tough problem to deal with?
That is, predicted shooting with fairly slow projectiles
hmm yeah, so when i was researching that the client spawns a fake visual only projectile, all other clients also spawn this fake visual projectile
but the server spawns an invisible projectile, that actually does the damage
but in the end i didnt bother, and just fire the projectile server side
shot is still instant feel to client, (muzzle flash, etc), but the actual projectile just comes from server
Is it a replicated projectile or does everybody just locally fire the same projectile but only the servers does damage?
only server does the damage
you should never predict damage, it leads to bad things
Yeah I think that's where I'm at right now. I suppose the only other alternative would be client-side hit the Texan with server just checking that the hit was plausible
Hit detection, not hit the Texan.
well, for my hitscan weapons, client tells the server who he has hit
projectile weapons (Sniper/Rocket Launcher/etc) then the projectile itself handles that
so projectile relies on the server view of the world
hitscan on the client view
can get away with a bit on projectile weapons as you need to lead your shots, etc, but for hitscan, you don't really have too.
I've actually been looking into a global projectile system, just haven't quite figured out how I would do the visuals. It's a subsystem with a pool of projectiles as raw data, and it just does stepwise line traces per tick. Basically if your projectile velocity is high enough it devolves into a hitscan weapon. It's super fast and lightweight, but I haven't quite figured out how I would do the visuals. I'm thinking either a global particle system, or a pool of particle systems, or something else
Been reading too many ECS books, it's infecting my development style
Roy Awesome had a ECS niagara system that works well
I guess if you use burst-counter like system and create one projectile manager subsystem for each connection, it'll work well
I dont use ECS because I dont have thousands of projectiles but I have hundreds of them, firing projectiles inside of OnRep locally works well in my case
I'm also thinking about writing a new projectile system from scratch but for now I dont have any bottleneck on my device, maybe after I test on target platform
Would GAS make the following easier? (Somewhat new to unreal and have not tried it yet). I have a system where the player can pick up certain objects and carry them. The actor that can be picked up has a component which contains the logic to handle the "object side" logic, while the player pawn has a component to handle the "player side" logic. When picking something up, I have a simple request-response RPC to the server where it checks if nobody else has picked up the object yet, and the replies to the client. The state of who has picked up what is maintained server side and then replicated to clients via state in the object component. This seems to work fine, but for these types of patterns does GAS considerably simplify things?
GAS does the very opposite of simplifying
Yea, I admit I watched a couple of YouTube videos but haven't yet fully understood all the use cases.
are you trying to implement an inventory system?
because you didn't use that word in your message even though it sounds kinda like it
Pretty much. I already have it implemented, but it's a bit more general in that the player can pick up different types of things that go into different "inventories", so-to-speak (which is why I made it a component). They can hold something in left and right hands, but fairly different types of things
I think inventory is not an area of GAS
GAS, is 'ability' thing, like 'action's. And also helps about attributes which is values like health, mana, energy etc
Ok, thanks everybody
GAS would be useful in an inventory sense if:
A) You wanted to restrict players from picking things up because they're under certain effects. Effectively, making the "Pick Up" action an ability.
B) You wanted to grant players effects or abilities when they equip items.
GAS wouldn't really help with how the items are stored, more what the items do.
Maybe my only answer will be to dig through the implementation, but does anybody know: If I transfer network ownership of an actor on the server with SetOwner, and then write to a UPROPERTY that is replicated with COND_SkipOwner, is there the possibility of still seeing a replication update to the new owner on the next iteration?
Can I spawn Actor on client if this actor is not replicated ?
Only for local purpose
@twilit flint yes I do this all the time for things like explosions and effects
Or things only the local player should see
Just make sure the client is the one spawning the actor and not the server.
how this can be null π¦
I'm using Open LEvel node with the listen option, is there a way to know if the map I'm currently in is already "listening"?
Just a guess, but I would imagine World->GetNetMode() would be NM_ListenServer or NM_DedicatedServer probably?
When I attach the player's character to some scene component (both on authority and remote machine), its movement gonna be weird. I thought that was occurred by synchronizing movement between authority machine and remote machine. So I set the 'replicate movement' option as false on attach, but it is still weird. What's the matter?
I'll try to set the movement mode as none when i attach it.
When i ClientTravel, what's happening server side, Is GameMode::Login supposed to be called on the host/server ?
Well, sadly it doesn't work. Anybody help?
Question re: World Composition/Level Streaming in multiplayer.
Let's say I have a large level that's broken into 100 tiles ( each tile being 500m x 500m)
If I have 2 players, in different parts of the map. For example, PlayerA is in the top left corner of the map, PlayerB is in the bottom right corner.
Does each player have to load the assets of the tiles in BOTH the top left corner and the top right corner?
Is it possible to make PlayerA only load the relevant assets in his tile?
If I have 100 players all in different parts of the world? Does that mean every player has to load basically a shit load of tiles?!?! Doesn't that defeat the advantage of using level streaming?
How does Fortnite do it?
Well attachment replication is different
Try using 'base' movement
I'm not familiar with CMC in deep levels but I know attaching is not a solution
Dedicated server loads all streaming levels by default, clients can stream just what is relevant to them. Dedicated does not load sounds, textures, etc so has more memory available for the essentials like collision.
Listen server config and world composition is much harder for the reasons you describe.
ah, thanks for clarifying this.
Why can't client shoot dead bodies (no ragdoll), but the server can. When hit blood vfx splat shows up.
Thanks for replying. What do you mean 'base' movement?
@slim nebula I'm not 100%, but that looks like something where you'd attach the character's mesh to the raft at a location, and let the raft set it's animblueprint. Disable the character class, set the capsule to ignore all collisions, and disable CMC. Possibly attach it to the raft as well. Then possess the raft directly. Things can still shoot and hit the player's character mesh and the character's pawn class would still exist to take damage and whatnot. Then on leaving the raft, you can just place the capsule at the controlling spot, reattach the visual mesh, and reset it's normal anim blueprint. Couple of easy functions and it'd let you keep your stuff pretty modular.
Actually, I don't possess the raft now. But, looks like there are some other things to try in your reply. I'll try it right now. Thanks π
I have the problem that the server of my game has an option that the clients must know before beginplay is called. What I currently do is parse the command line for the option on the server. This sets a variable on the GameState in its constructor. Replication is enabled for this variable. Clients that are connected to this server spawn actors based on this variable during beginplay. However, I noticed that the variable is not being replicated in time for the beginplay call in the clients. Is there any way to delay beginplay until the variable is replicated? Or should I use an entirely different approach?
@quaint nacelle Typically you can just run the logic from the set variable's OnRep if it's for a client only spawning of something visual. Although I'm not sure why your clients have to care about spawning things that are based on server state? Traditionally you should be spawning replicated things on server for these clients, which would already have the data you've set.
@kindred widget The variable in question here is a path to a replay file on disk. Each client will consume this file and do all setup and spawning locally.
Ah, in that case, likely just do it OnRep. Of if you really need to use Beginplay, initialize the variable to something invalid, check on beginplay if it's valid somehow, and don't do anything if it's not except set that beginplay has ran. In the OnRep, check if Beginplay has ran, and if so, run it.
Alternatively, you can do it dirty and just check on a timer if the OnRep has been received after beginplay and stop the timer when it's received.
@kindred widget We'll look into that. The help is very much appreciated, thank you.
This might be something Iβm overthinking but using games like COD when you have a multiplayer game that has a story mode, is the story mode played on the clients machine only or is it played on dedicated servers? If the former how does it work? Is it as simple as having a menu that separates the two types of game play.
Further what about games like destiny that which is online only and has a βstoryβ mode that you can play. How do you separate out PvP from that state where itβs single player but sort of like Coop?
I ask this because Iβm trying to decide which direction to go
Because COD and Destiny being what they are, there's a good chance you're always playing online on a server for co-op purposes. If there is no co-op, then my guess is you're just playing offline.
Gears of War just had you playing the SP campaign in "listen server" mode, so that other players could join your game. There was no dedicated server for story mode.
If you have no co-op, just play offline. If you do have co-op, playing as a listen server is probably best. You won't be reaching destiny scale anyway.
And it's wasteful to use dedicated servers for that kind of thing, where having a level playing field/cheating is less of a concern.
Answer really is that "it depends" though.
Not familiar with recent COD but Destiny has a very complex server architecture
Yeah doesn't surprise me at all.. not familiar with the game but I know it's basically all online
Destiny has a mix of P2P and multiple layers of servers for activities and player data
You essentially log in to a main character server, then into instanced world servers that I understand aren't a single server either
And the core gameplay is P2P IIRC
So they essentially put cheap stuff that needs strong authority on their servers and offload the expensive, less authoritative gameplay to clients
makes sense
How Networking Works in Destiny 1 and How It Will Differ in Destiny 2 (According to Bungie, Redux) - destiny-networking-revised.md
We're working on a shooter roguelike. When you're playing, you're always playing in listen mode. Your friends can just join you without having to restart or reload your map etc. We haven't thought about exactly how we're gonna handle PvP (it's planned). Would probably have to travel to a dedicated instance for the PvP levels.
More on their latest networking changes here (scroll down to "Talking Tech") : https://www.bungie.net/en/Explore/Detail/News/49596
Nice!
My 3000 hours in that game might as well help people
π
I appreciate it guys!
Hi, when i serverTravel from a lobby map, all clients are connected to the new map but the host has no playercontroller, i'm not sure how i should handle the host, by creating the PC and calling postlogin manually ?
Dedicated or listen?
Listen
Mhh i just have a ServerTravel when the host click a Start button, clients are connected, the host aswell but the host just has no PC/Pawn (only a camera and can't move)
I'm using sessions aswell, i don't know if it has an impact on that
If you're in the same map you should have a PC at least
I have 2 maps, one lobby map and one game map, everything is fine for the clients but not the host, PostLogin() is never called for the host, i guess it's a problem
Might be that login or prelogin is failing for the host for some reason
Not really sure what happens after that
@elder sable are you overriding any functions in game mode or doing anything weird regarding pawns and controllers?
I override PreLogin PostLogin InitNewPlayer
I call the base function each time, i don't think i'm doing something weird but i will check that :p
Just dig through those and make sure you're not doing some sort of has authority check that never returns or something like that
Yep i know what to check now, thanks for your help π
Thanks. I couldnβt find anything overwriting. I do set t.maxfps via command for each player via execute node (ranges from 60-360fps). Iβve set character ticks to 60hz so see if that helps.
Hi. I want to rotate my character to cursor location before it executes an ability.
Right now every tick in my playercharacter class updates CursorToWorld decal (like Topdown template) with a new location based on cursor. However this location always returns 0,0,0 from server POV. How would I go about solving this? Much thanks.
btw location returns 0,0,0 because PC->GetHitResultUnderCursor(ECC_Visibility, true, TraceHitResult); like the server doesn't have a cursor at all
you need to send that info to the server
we have the client send an unrealiable RPC with the mouse position to the server
I'm doing a tut at the moment, and I'm struggling with the concept of reping to simulated proxies.
In this tut, they approach what gets replicated in, sort of, three parts - Autonomous, Server and Simulated.
My question is if something is getting rep_notified to something via server, wouldn't the simulated get that info too?
Or is it only the autonomous clients that get the update?
thank you!
so it should be something like this?
tick
if client==true
FHitResult TraceHitResult;
// update client cursor
// call UpdateServerCursor(TraceHitResult.Location)
func ServerRPC UpdateServerCursor (FVector CursorLocation)
CursorToWorld->SetWorldLocation(CursorLocation);
actually probably better to only update server cursor location before performing an attack rather than every tick
any tutorials on how to make Find a match with dedicated server setup for mobile games? where each match has random map/new people etc..
or an addon on ue4 marketplace?
I've found Multiplayer with Blueprints (AWS) but too expensive and not sure if it's worth it
we send it every frame @twin juniper
but we send it as a FVector_NetQuantize
as it does not need to be super precise
another thing you could do is like you said, just wrap the location into the rpc to server when activating the attacking
@elder sable thereβs a function something βhandle new playersβ I think works for server travel / new map. Not at computer so donβt know exact but I use this in my listen server game
You can replace post login with it
Hey guys.
I have a replicated UObject, but when it destroyed on server it does not call PreDestroyFromReplication. Any ideas how to destroy them on clients whenever it is destroyed on server?
@meager spade its throttled slightly, not every frame
no more then 20 times a second
do your logs confirm that?
CharacterMovementComponent traces towards bottom surface of your Character and checks if there is any moving scene component and if it moves, CMC also updates your location
But I know nothing more, some other guy who has knowledge about CMC should guide you further
great resource, thanks stranger
What's the best way to restart a task when a blackboard actor changes.
That is, if Target Enemy changes from Unit A to Unit B, I would like to abort this task and, let the the BT realize it should start this task again.
nevermind. It was just setting the decorator to "On Value Change"
Edit: also, wrong channel...
If pawn is possessed by AI then IsPawnControlled would return false on clients. is there any other thing to check if pawn controlled by either player or ai on client ?
^ aren't AIs tasks and stuff server only?
what would be purpose of checking the status on client be
yeah, thats the problem. ai controllers exist on server
but i need to let clients know if the pawn is controlled at all. but seems like would have to add a bool just to replicate control state
just do IsLocallyControlled
you also have a version of that but for playercontroller
also, there's an onrep for when the player state is replicated
maybe handle that switch there?
unless ofc your ais can switch aicontrollers
on server i have pawn controlled by either player, ai or nothing
on client i need to see if pawn is controlled
for now added replicated bool that is set onpossess/onunposses on server
If I want to assign my players different pawns when they join, where should I do that? Specifically I want the first player to be a VR pawn, and the later ones to be spectator camera ones
You could have logic in your res pawn code that counts the number of pawns in the world and selects different class to spawn with accordingly. @crimson valve
why si the pawn not turning? im using pawn sensing a a move to
it works in single player
i need to ask which is the better or comparison between gamelift and playfab
I guess it's HandleStartingNewPlayer, thanks !
if an actor is replicated, and it has a child mesh component that is not replicated, and the actor moves, does the non-replicated child mesh component moves too?
yes it does
if you're replicating movement for the actor
[either through a movement comp/breplicatesmovement/other method]
Could somebody help explain the difference between game modes and game states, especially in the context of a multiplayer game
First thing to know gamemode only exists in server
And that means that only the dedicated server or host player will run an instance of that blueprint, right?
I'm a little iffy on what should be replicated, but I'm pretty sure about that one at least
So does an instance of everyone's game state exist on every client / servers instance?
Or does the game state only exist on the owner
Yes
If replication is involved, it means the class is communicating with others
Gamemode only exist is server so it does not need to be communicate with others
So no replication needed for it
When you join a session as client, you connect and communicate with servers world/instance
When server do something on its own instance, like spawning something, you'll see it because it will be automatically replicated to you or if server change somethings position you will see it too because server keep sending data to other clients automatically
But sometimes you need to tell the server something like "I changed my position" then you send RPC and that RPC is the messenger between your world and servers world
GameState exist on everyone
Okay, was just making sure. That is what I assumed
So if I have an fps and want to run a line trace on the client and then communicate that I hit someone to the server, and everyone else through the server, that's an instance where an rpc is appropriate?
Weapon class
Think like this
You have a listen server, and one client so you have two players
Each player has a world
If you spawn something replicated, client will use server's instance and communicate with it by using RPCs
if you spawn something not replicated it will only exist on spawners world
so no one will be able to communicate with it
gamemode is just a normal class created by Epic to handle game's rules etc
you can create your own class and replicate it
Yeah tbh I understand the concept of replication as you're explaining it
and handle your own things
I guess I'm asking more where I should transition from my game mode to the individual game states as scoring happens
And also I don't know how exactly to maintain references to all player's game states that the game mode can access
So like how "get player controller" gets the player's singular controller, unlike something like a widget where you'd need a reference to that specific entity
Pawns holds their references to controller, when you do damage, or notify players someone is dead etc. you should also send the killer player in that damage function or such
So as server you can access its controller, then cast it to playercontroller then get its playerstate then add score etc.
And to update the UI from there, could I use a repnotifiy in the player state?
I kinda ran into a roadblock last time where my death event was connected to my scoring in a way that caused only the dead player's UI to update
Umm, not with OnRep I guess because OnReps also updated by late joiner
Oh sorry nvm
Yeah just do what you've said
So even something like "onrep set UI to equal score variable" to put it crudely?
So I currently have a bunch of stuff following my onrep for health, including player death, should I cut that path short by making a death sequence earlier than that?
Sorry I don't know much about huds, only individual widgets
What am I doing is I have an OnRep for my health and if I have a negative or zero value for that I call a delegate and every class handle its own logic
I'm almost thinking (typing) aloud at this point but I think I should do what I said to be able to replicate that event easily
Characters delegate stopping movement, preventing weapon from fire, HUD creates a widget, playercontroller prevents input
etc.
They all subscribe to players healthcomponent's delegate on beginplay
Delegates are event dispatcher in BP
I want to be able to pan the camera around while dead, kind of like Destiny, should I not do anything to stop the controller from taking inputs in that case?
Its totally up to you
I unpossess pawn when I die
And possess a spectator pawn
You can do your own logic
Also a good solution
I'll figure that out, but I honestly just want something playable so I can start testing stuff
If I want to track player scores individually through the player state, but then want to add them together to create the team score, is that a better solution than having a separate team score variable that updates with all player score updates?
Track team scores in gamestate
just add the same score to the gamestates teamscore variable
when you're adding to playerstate
So despite the name, game states should be used to track in-game modes, right?
Like if it's death match you would change the game state to "GS_Deathmatch" or something equivalent and store all of your mode-related logic in there?
Idk, totally depends
My initial question was actually about the difference in usage between game modes and states and I think I still don't get it
I'm sorry then either I'm sleepy not understanding you or having trouble with communication
No, you've been helpful about other questions haha
Have you read eXi's PDF? He explains the question very well
I read a good portion of it, but I'm not sure if I should read it entirely even if I don't understand it practically, or if I should go one section at a time
I think you should read it entirely, at the one of the beginning sections the directly explains the role of GameMode and GameState
Okay, I'll do that then
Its a must-read paper for before deep diving into practice btw π
%10001 recommended for everyone, even for experts
After googling and reading engine code, I've solved this issue. I decide not to use AttachActorToComponent Function. After the player interacts with the paddle, each machine (remote, authority) calculates the player's location on their tick. I refered to these followed links:
https://forums.unrealengine.com/t/attaching-a-player-to-a-player-causes-jittering-in-networked-game/29394/9
https://forums.unrealengine.com/t/mutiplayergame-problem-how-to-attach-a-passenger-to-a-car-how-to-solve-jitter-on-client/131895/2
https://answers.unrealengine.com/questions/790345/attaching-client-to-moving-pawn-annoying-jitter-he.html
The best way to do this is not βattachβ them at all, and in fact just use the βreplicatedβ location and update the attached actors position on tick. (ReplicatedMovement.Location). The reason it jitters is because the packets that come from the server arenβt necessarily smooth, so hard-attaching doesnβt work as well especially if youβre looking ...
I know that this is kind of late, but this is what I found works, after months of testing. I like to do this on server, and multicast, that way no one sees them lag, but Iβll try and figure out a more optimized way to do it. When when you enter the vehicle, you need to call a run on server event. This even should pass through your player, the ac...
What can I do to get a reference to the client's player controller instead of all of them individually?
@elder sageFor what use case?
I think the issue I'm having with my UI health bar seemingly not updating is because it's actually creating a number equal to the number of players because it fires each time a character spawns and then gets their controller
what I have so far
I've made sure that the progress bar update isn't the issue, the health variable isn't either
Part of your issue is that this event only ever happens on the server.
why would you not just drive all that logic in the hud to begin with?
because I don't know what I'm doing lol
that's fair π
I wanted a reference to the hud to update it through the character
Also, if you have any C++ ability. I strong recommend making a static getter for the local controller via GameInstance->GetFirstLocalPlayerController()
GetPlayerController0 works, and is fine for testing, but it has some multiplayer bugs that aren't quickly apparent, and also don't always happen. May be frustrating to debug later.
so is the idea that I should set it up in a way that means I don't have to do that?
also now that I look at it maybe the issue is that the reference is being set several times sequentially?
because the beginplay/onpossessed runs for each character that exists?
I actually initially wanted to do it the way I'm attempting so I could avoid casting to the HUD for the reference every time the health updates
although I have a quick idea
well, for starters, I would do that in the UMG itself.
and just update the widget when that value changes.
are you using BP only?
so far yeah
If I use a listen server instead of a dedicated server and connect a player to another, I will have 2 game states, one on the connecting client and one on hosting client that has authority, right? Contrary to dedicated server, where there will be 3 instances of game state, one for each clients + the server itself that has the authority?
It's annoying that pawn's Restart doesn't have a BIE attatched to it in native code.
@upbeat basin correct.
Thanks
so I went to print the array length of all of that widget created and see this
event receive draw hud is a tick function, it turns out
what is the most direct path to a reference to the PlayerState of this character?
Character should have a get player state function
yes but it's actually turned into a generic actor reference it seems
So cast it
am I doing something wrong here? the event is only running on the server, likely because it's coming from the game mode, but I'm not sure how I should trigger an event for all players
no, easiest way is to get the first local controller
hmm okay
thanks
UGameplayStatics::GetPlayerCharacter()
what it will return
my character or first character ?
any idea
you know you can take a look into inners of that method right? Or at least look at the arguments or comments there
/** Returns the player character (NULL if the player pawn doesn't exist OR is not a character) at the specified player index */
Yeah just take a look
anybody know offhand how I'd get my dedicated server to automatically submit crash reports?
You can set up the built-in crash reporter to talk to your own server
Or you can replace the crash reporter with a custom one
yep, I've got it sending up to sentry.io
if it's running on a server someplace I won't have the UI handy to press send
There's an unattended setting in ini IIRC
oh nice, thank you - I'll take a look
Looks like for 4.26.2 in \Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp on line 218 and 228 it checks for -unattended and -crashreports command line flags, so I'll try launching with those
Assuming the who killed reference is always the responsible character, then that's easy. Assuming it's not, you should use the instigator field to keep track of which character owns which weapon which owns which bullet etc.
Can someone help? my behavior tree (on monsters) are not executed , there is nothing in the checklist.
I run the BT server side
The AI controller ( first image) is set in the Mob , (second image)
What i miss?
the mobs are placed in world
The reference is taken directly from the "event any damage" node, so it's an actor reference that I can cast to a character. I think I more or less answered my question by the time I got off last night, but thanks anyway
However, I was running into an issue where the bpi I was messaging from my player state to my game mode would only update for the host player, and it doesn't seem to have replication options
@lost dune have you placed a breakpoint On The run behavior tree node to check the everything is all good by the time that gets executed?
First guess is the RPC doesn't work
Cause that's an AIController and AIController don't exist on Clients
And if they do, the Client is usually not owing them.
Now my BT is executed , but the decorating return always false
have aggro decorator is not tried
the screen stays like that
Thanks for posting these, you just solved an issue my game was having as well :)
How to end a task? Im new wuth this
I'm glad to help you π
Why doesn't the client recognize the server mesh collision after the server plays a death animation and gets up (to resurrect).
the client still thinks the server is in the ground...
But the mesh (server) is standing up and bullets fly through him.
I shoot the ground where he laid and the server gets hurt. Is this like a root replication problem with montages?
I replicated the functions and model but no go.
collisions are local
server having collision on something in no way means client has the same
thats on you
Via simulated proxy I'm doing a CubicInterp that's used to set Velocity
Without moving or adjusting anything, the pawn goes mental
And, eventually, results in a NAN on the actor transform
It's a custom CMC, so Velocity is really just a number.
I thought it might be a uninitialized variable but I can't see to find one
Anyone experience this before?
Ah, turns out the alpha I was using would go beyond 1 and cause issues. Clamping sorted it.
Enum replication (enum class uint8) is considered as single uint8 right?
When value changed it will only send one byte
Hi
Can I make dedicated server for handling matchmaking , leaderboard ... For unreal engine ?
For matchmaking you are either using something that is already there like steam or EOS matchmaking or create your own
And I wanna build this dedicated with golang
@empty axle
Is there any tutorial for connecting my own dedicated to unreal system ? Or it is simple like creating request from unreal to my server
I doubt there is one. You need to engineer it by yourself
And yes you can use http requests to communicate with that server
What Unreal system ?
You said "matchmaking"
Unreal does no such thing
Unreal does multiplayer, which you will always use Unreal servers for
Matchmaking, leaderboards, are handled by platforms (Steam, etc)
Both are completely independent
Oh because of the internet they just make players connecting to each other nothing else
I was confuse
@empty axle
@bitter oriole
So for connecting and overall in game like movement shooting etc we use unreal multiplayer system and for matchmaking , scoring ,... We use our system or pre built system ( and they use simple http request ) . Right ?
yes
Thanks β₯οΈ
Usually you use the current platform's services for matchmaking
You can decide to roll your own if you want to for some reason, of course
And one me question . Unreal multiplayer system is like server client ?
Or host user ?
Yes
Yes for server client ?
Both
Yes
Thanks both of you
Hello, im trying to make a simple fps game. I have got a line trace system that can detect when a target is hit, the health goes down but the UI stays the same. Is there an easy way of setting this up?
try looking at the shooter game from epic
quite a few popular released games used to be shooter game when they first started
like the shooter template?
how would I set this up? @lucid sedge
accessing UI from game code is pretty bad practice
any changes in your Health should go through SetHealth function, which will also broadcast an EventDispatcher OnHealthChanged with inputs of CurrentHealth, MaxHealth and if you need it, PReviousHealth
when your widget is instantiated, you inject a reference to the object its representing into it
simplest way, in case of overhead health bar is just accessing GetUserWidgetObject from WidgetComponent on BeginPlay, casting it to your Widget type, and setting self to a variable in Widget you create for that purpose
then OnConstruct in Widget, you bind to the Pawns? OnHealthChanged, and the Event handling it adjusts the UI
Ill try this out and see where i get, thank you.
you also do it when the reference to the Pawn is set
the binding
and you immediately re-intiialize the UI whenever its context is changed
if its not an overhead WidgetComponent, best call into your HUD and tell "i want the widget to this character created"
then in WIdget you create a reference to your Character, you make it InstanceEditable and ExposedOnSpawn
so HUD can inject the reference into the Widget at the time it instantiates it
also note, since this is multiplayer
Widgets are in no way replicated
so to update clients, you need to have Health variable run RepNotify, and broadcast new health value from OnRep_Health function
in my inventory if i want to play a sound after certain events such as using or destroying an item
I play the sound locally right after sending the server rpc to use or destroy the item
assuming that it will always succeed even tho it might fail for some reasons and the sound is still played
how do you guys do it?
how do i do it the simpler way because im kinda struggling here (im quite new to game programming in general) @lucid sedge?
@lucid sedge It is bad, and there's a reason for it. Game Code doesn't change as much. UI can. If you cannot generally rip out your entire UI and replace it without affecting game code, you're doing it wrong.
Alternatively your gameplay logic could just call a delegate, and any widget you want to can bind to it. Then even your main widget can be replaced with a few clicks and no issues with it missing.
I got a question, how would I go about replicating my wall run for multiplayer?
Requires a fairly deep integration with a custom character movement component to do it properly
Fairly sure UT has some limited wall-running implementation
Heys guys, Anyone knows a good alternative to SpatialOS ?
They seem to kill the service for small developers....
Does it work similarly to how replicating sprint works?
Sprint is usually a bit easier because the CMC already has the concept of modifying max speed, and that's built into the rewind system
I'd look at the UT source to see how they implemented it
where can i find this?
Hello! Is here the right place to ask about the ReplicationGraph?
Sure
Basically i watched the shooter game example code (nodes) and couldn't really figure out how you can tailor a node which serves (gathers) actors for a group of connections (players) so i want to be able to sync a specific actor only to a group of players and it should be always relevant (no spatial culling or similar) is there some example code how to achieve this? UShooterReplicationGraphNode_AlwaysRelevant_ForConnection::GatherActorListsForConnection is bit confusing because it seems to be called once? and process all viewers? right now i don't really understand how the nodes are called once for sync tick or sync tick for every active connection. any info about clarifying it more would be great.
The nodes themselves are either global or per-connection, what you can't do is create a node that deals with a group of connections. What you'd need to do is create a per-connection node, and add that actor to the list of actors in that node.
However from what I remember, if you have any spatial culling at all - it will always take affect over any nodes. Last I checked you couldn't have an actor that was spatially relevant for some players, and always relevant for others.
so i can modify GatherActorListsForConnection and add this actor every tick and it should work?
The actor is only routed once, the node keeps a reference to it
And the replication graph appends every actor from the nodes for that connection
something like this would work properly? or i need to do checks if it was already added?
https://i.imgur.com/lH9KLA2.png
Could work yeah
Note there could be more than one viewer per-connection - e.g. split-screen play in a networked game
yea i see multiple viewers are about split screen and vr and similar i guess?
Just split-screen
but in my cause it's not important ok
Alternatively, you would add a global graph node that handles adding that actor to different connections
e.g. we do something like that for actors which are only relevant to their matching team
is there a global node in shooter game? so i can check it out or there is no difference? on how you add the node to the system
only*
The spatial node is a global node IIRC
Or even UReplicationGraphNode_AlwaysRelevant - that's a global node for any always-relevant actor
okay so i have found something very weird with print strings. I placed them at the end of my wall run to check which side of the wall they thought the character was on, no matter what the server always thinks that the character is on the right side
so the right wall works fine but the left one does not @chrome bay
Must be down to your implementation, can't really help there
Guys I have a question, the player's rotations are replicated by default in the player or you have to do the rpc and replicate its variables?
can someone answer a few basic questions for a multiplayer beginner?
For characters it's done automatically
noop
thanks for clarifying π
i dont know if any of you played a souls game where you can join a session in progress
up until a player decide to start a listening server, the game behave like a single player game?
Probably
Souls is P2P I believe
Or at least, doesn't use dedicated servers for players in each others' worlds
yeah i think is p2p
So yeah, in UE you would just have each player be a listen server from the start
Unless they've disabled online player for whatever reason
I don't think you can switch between listen/standalone on the fly without changing to a new UWorld, but never tried it
theres a way to stop a listening server i assume
if they disable the option, no connection allowed
can listen servers still joins other sessions, right?
Yeah but they become clients then
of course, as long as i can restore the server once the connections is interrupted i cant see the problem
am i missing something?
If you're hosting a game, you can tell all of your clients to go to another one. Servers joining other servers and bringing all of their players gets complicated though. Lots of ways to do it.
Usually you would use beacons to create reservations for e.g., that's quite complex in itself
Similar to party systems really
Is it possible to test steam oss with appid 480, with a cooked game? My presence is updated when I launch the game using command line, but when I cook the game and run the executable, it doesn't change anything
If you run the packaged game in Shipping mode, then the game should be started from Steam, or have an appid.tx tfile next to the executable witht he appid
Confirm that shift+tab opens the Steam overlay to diagnose
Adding the steam_appid file fixed the problem, thanks
Hi. I have some code that needs to run even when no one is connected to my server (dedicated), but it doesn't seem to work, how can I fix that?
How are you running it?
I run it on a EC2 aws instance, if that's the question?
And I use the exe properties to select the start map
I think Adriel meant how are you running the code you need to run. ie. You can have something start running in the game mode's begin play.
In BeginPlay I init a looping timer calling a function every 2 minutes. That function makes a graphql request (If a condition is true).
Begin play on what, GameMode?
Its the BeginPlay of the map's mode, The parent class is GameMode
Ok never mind, dumb error. I had a non-handled cast failure..
<@&213101288538374145> cross posting by @lucid sedge
:triangular_flag_on_post: Ujjwal#1773 received strike 1. As a result, they were muted for 10 minutes.
Well I'm back, for what now feels like, my daily question. haha. In my PlayerController, I'm keeping a reference of my CameraActor that the player will possess for the entirety of the game. I'm trying to RPC this to the client so it too has an accurate CameraActor reference. Here's how I'm doing so:
{
Super::OnPossess(aPawn);
if(HasAuthority())
{
UE_LOG(LogTemp, Warning, TEXT("PC OP"));
CameraReference = Cast<ADefaultCameraActor>(GetPawn());
if(!CameraReference)
{
UE_LOG(LogTemp, Error, TEXT("CameraReference in PlayerController#OnPossess is nullptr"));
return;
}
CameraReference->SetPlayerControllerReference(this);
//Now replicate to client
SetCameraReferenceClient(CameraReference);
}
}```
```void AArcanumGenesisPlayerController::SetCameraReferenceClient_Implementation(ADefaultCameraActor* CameraActor)
{
CameraReference = CameraActor;
if(!CameraReference)
{
UE_LOG(LogTemp, Warning, TEXT("Set Cam Ref !CR"));
}
else
{
UE_LOG(LogTemp, Warning, TEXT("Set Cam Ref CR Good"));
}
CameraReference->SetPlayerControllerReferenceClient(this);
}```
Through my debug messages, I know that CameraReference in OnPossess() is not nullptr. However, when it arrives to the client in SetCameraReferenceClient(), it's a nullptr. Any ideas?
@finite portal why is camera reference not just a replicated variable?
Well I remember hearing somewhere that replicated variables are checked every frame to see if they need to be replicated, and I just didn't need this to be checked every frame for that. I just need that initial reference set at the beginning of the game
Please see the following: the function restart is called on client when itβs possessed atleast when itβs spawned for the first time by game mode. I canβt say if itβs called when itβs unpossessed by a controller and then possessed by another but when itβs spawned by AGameMode it is definitely called on the client and when it is called youβll ha...
Try the OnRestart approach.
Much appreciated! I'll give that a try
For reference, overriding the ClientRestart(class APawn*) method in my PlayerController did the trick!
Maybe a dumb question but I have read some conflicting info on this: Do all members changed of a USTRUCT replicate simultaneously if they are modified simultaneously?
hello guys, i asked this before and i got a replt but im still confused, lets try again
im a complete beginner when it come to multiplayer but i do understand how networks work. im thinking about implementing a multiplayer like souls game, where every player has his own world and can become a server for other players to join
how could i go about implementing this? every player should start as a listening server? can i make them clients at runtime?
Yes. That's what we are doing in my project, every player is hosting a listing server, and when you join another player's game, that is you becoming a client of them.
but where is this information stored?
What information?
whater you are a server or a client
If you join a session or open an address, you are joining as a client.
so this stop the server since you are now a client or you have to handle it manually?
It'll stop your local server, yes. Or rather, you will be loading a new map. You will have to save your local progress to disc
So yes, you need to have a hard load when joining. It's not going to be 100% seamless out of the box
theres no way around, i get that
In our game we only have two hard loading screens, beginning of the game and when you join a session. But there's no reason to not have hard loads, we just decided against it for the aesthetics
since as i said, im a beginner to mp and still confused on how ue handle it
how do you debug this kind of stuff in the editor?
If you're a beginner don't try doing anything fancy. You debug it just like anything else, but you will have to learn about sessions if you want to have some sort of friends and matchmaking setup
You can start using sessions without C++ in lan mode. You'll need to bust some code open to use steam
so i cant debug two listening servers in editor
the second one will always start as client
Sure you can. Dig into the startup settings. Also don't start as listen, start as standalone, but have your first map load your gameplay map as listen.
Play in editor will be decent but you'll want to test as standalone, just right click the u project file and hit launch game.
thank you so much adriel
if I do Open LEvel with Listen option, what does the listen option means?
so far, the only thing i found that give me somewhat the desired result is to launch 2 standalone clients and enable 'launch separated server' in the play settings and connecting both clients to it. to me it looks like it launch a dedicated server
tried to make steamworks work but no luck
Listen means you are open for incoming connections aka hosting a game for others.
Listen = Player and host/server
yeah but how do you connect to it? the only way is using sessions?
what kind of boolean check do I have to do if I want to know if I opened the level with listen option?
If you have ports forwarded you can just
open address
you don't need a port
its probably too late to do this kind of stuff for me, i swear i tried that
its working, thank you guys
anyone knows?
i dont think there is a boolean, you either keep track of it if you want to know from the instance that opened the level
or you know that if the server actually respond with something
use IsServer
wouldn't that be true too if I played as client in the editor?
No
Does unreal have support or integration for teams that I'm just unaware of? Or is there a starter guide in the 100+ page pdf?
do u mean in like grouping players together?
or do u mean more like source control?
I mean is there a "team" system, before I go and try to figure one out the harder way
I don't know enough about the engine to know if it has this, but something that lumps actors in to easily target able groups would be great
I dont think so
So should I just do something in my gamemode where when someone logs in, it gets their player index and then puts them in a "team" array?
Also I'd need to figure out the best point to apply custom collision channels to each team, for line traces, and would also like to create some kind of color filter for the player
Although dynamic material instance sounds right for that
just store the team value in the player state and assign it there.
and on your line traces, just check that.
i'd use an interface
Adding on, if you really need the trace to not be blocked by teammates, then you can set up a couple of custom collision object profiles, one for each team, so the trace goes through teammates. But only if truly needed.
And assign accordingly depending on which team they end up on
Yes, I do want to be able to shoot through teammates. Should I just assign the collision profiles when they log in or something?
Also, should I just make this a bool? I don't see what other type it could be that would offer anything extra
That's all up to you. Wherever you end up deciding where/how players get placed on teams, or at some point after that, you can assign the relevant profile then. You could maybe do it in BeginPlay on your pawn actor if you're sure you've already assigned the players to their teams by then.
I would make it a uint8 and assign team numbers. So you can expand the number of teams down the road if you desire.
And just make a helper function to check if they're equal
Good idea. All of the "team A?" bools in the tutorials I see just seem lazy
anyone ever done client predicted root motion outside of AbilityTasks? I'm not using GAS and I'm assuming AbilityTasks require GAS to work
So in theory, would I be able to do something like assign each player a team solely for them in a free-for-all?
Sure why not! Two players would be able to hurt each other if their two team values are inequal. And in a free-for-all case, you wouldn't need multiple collision profiles, your traces wouldn't need to pass through anyone.
How would the bit about collision profiles work if I were to also implement team modes, though?
Like, is having the local player be on one "team" profile and the rest on the other feasible while replicating the actors?
It might take some experimenting since it depends on who's doing the collision checking, clients or server or both. I suggest just getting started without worrying about shooting through teammates at first, worry about that later. Get it working all good except for the shooting-through part, then use the new information to inform how to proceed when you get there.
Okay, I'll do that then
Hello guys. I'm confused a little about ActorComponent replication. I have a component, which is responsible for procedural animation based on the timeline. I set IsReplicated to true, but seems like component is not replicated at all. Do I need to replicate every function/variable in my ActorComponent class or what?
You should replicate only necessary properties and functions to make that work.
It would be really bad if setting component to replicated would automatically replicate every property and method from it
Do arrays keep order and nulls when replicating ?
having array of actors, each may have value or not but order is important
is the actor the component is in replicated?
Yeah
Attempting to use ServerTravel to transition from a lobby to the game. All players transition fine, but it seems some data does not persist. I am using the PlayerName in the PlayerState. I created my own PlayerState child and have a variable (enum) there to determine the player's role in the game (player, spectator, etc). When the travel completes, the name persists just fine but the role variable is lost. Is there anything I need to set for this variable to ensure it persists through a level transition?
(seamless travel is enabled on my gamemode)
Ah, figured it out. I had to override CopyProperties and manually set my variable to copy after the transition
For anyone else with this issue, this kinda helped https://answers.unrealengine.com/questions/303795/transfer-playerstate-data-during-seamless-travel.html
i'm having a bit of a problem with same process testing of multiplayer session's. when I host the game in one window, and try to search for it in the other one, I get 0 search results. if i uncheck run in same process then i do find the other session as expected.
Yeah multiplayer sessions don't work great in PIE, I think unchecking that is the only way around it. And even with that unchecked I've noticed some inconsistencies. I generally end up running instances of the game manually, using a .bat file to execute it
"path to UnrealEditor.exe" "Path to uproject file" LevelName -game -log -NOSTEAM
And if you need to run a dedicated server you can do
"Path to UnrealEditor.exe" "Path to uproject file" LevelName Port=7777 -server -game -log -NOSTEAM
Hi there,
could anyone explain me what "Warning: SetReplicates called on non-initialized actor Default__SExplosiveBarrel. Directly setting bReplicates is the correct procedure for pre-init actors." is supposed to mean? I tried to google it, but there is no information about the warning
Are you calling SetReplicates in the constructor?
I think you should just use bReplicates = true in the constructor
Does anyone know how to make good spawn point logic? At a minimum, I'd want to compare each player start's distance to each enemy, and then I'd like to check line of sight for each as well
Got a generally 'interesting' question about ServerEvents, Security & Server Overload/Performance
Maybe someone has experience or expertise in that sector.
Please take a look at the Screenshot for better visualization & understanding.
Everything client side can be tampered with really iirc
What stops a client from it?
true, but if someone decides to bypass and call an event 1000x times (f.e). Is there any way to prevent that? (if this danger exist)
Delegating things to the server
So if the client wants to fire and tells the server that, the server checks how much ammo the client has and can prevent it if they have zero
You can check if a call was made too many times on the server and if that happens kick the person out or close the exec on server
Maybe delegate is the wrong word
But that sounds like a generalized solution, doubt you would want a check like that everywhere
So people can cheat engine their health as high as they want, but if the server is the one that checks their health and basically just says, "no, you're dead by now," the most the client can do is more or less pretend to be alive in their own game instance
In reality, someone can cheat and do whatever they want to their client as long as the server communicates what it needs to to the other clients
Obv kicking them is ideal, but it really doesn't matter if they effectively just un-replicate things for themselves
good solution - Question is if unreal has that already inbuilt!?
I doubt honestly
so basically make database with calls - add +1 on every call - if exceed certain number disconnect - if high amount ban
or on the server itself, something like requests per minute allowed
thx for the talk
Yeah, a Macro would be good for restricting to a max, in the end if you have heavy code behind it, better going through the Macro than always executing the heavy code if it happens
Never trust the Client with anything
Really, if you want something competitive, the best you can do is make it dedicated and never trust the client with anything except their inputs
anybody knows how to stop a server after has been started?
hello guys, i created a multicast rpc function that is called inside a server rpc function i made too
the problem here that if iam the server that called the server rpc
the multicast function only perform task for server only
and cant see any other player to perform the tasks
but if i was a client who called the server rpc function the multicast function perform the task for only this client and server
so other client are left without anytasks performed for them
any help would be appreciated
In what blueprint are you calling the RPC?
i have an interact interface function that i call the server rpc function placed in player controller
and thee multicast function called inside the server rpc is also placed in player controller bp
Player Controller only exists on the single client and the server.
So a multicast RPC would only ever go to the one client.
i tried to call it inside a actor
in the level
and it do the same
but i dont think that is the problem
cause the server rpc is the one calling the multicast one
so iam on server side before calling the multicast one
When you're calling a multicast on a player controller, you're calling on that specific player controller, and since that specific player controller only exists on the server and the client owning it, it won't go through to other clients.
yeah i know that
but if iam in aa server rpc
in a server rpc
i have all player controllers
since iam the host
Right but if you're RPCing WITHIN a player controller you're referencing only a single player controller.
Doesn't matter if you're server or not.
If it's something all clients need to know, then a Multicast from Gamestate would usually be the place to go.
If it's about a specific player, playerstate
so should i put the multicast function only in game state
or both the server rpc and multicast rpc
i need to spawn system for all players
so all players can see the effect
so i think i will uyse game state ,right?
That sounds like you should be spawning a replicated actor.
Rather than using an RPC
let me try this
but how can i make the system replicated
its a niagra system
iam spawning it
What type of effect is this? Like is a player being hit by something, are they shooting something? What is happening that causes this effect to appear?
just this effect appear when a player press e
but this effect should be seen by all players
And all players could potentially press e and make this effect appear?
ok, so that for sure sounds like you want some gamestate control.
I assume all players will be using the same character BP?
u mean the pawn right?