#multiplayer
1 messages Β· Page 111 of 1
I've a trace system and thats connected to the actor as child and If I look at something (lets say a platform in this example) I press E and want to get the parent from my actor. My actor at this situation is the collision sphere child from that platform.
and behind that interact functions is a simple move component to xyz
That "InteractionArea" would be the FocusedActor
Normally when interacting you do something like:
1 Player Side) Player Pressess Input > Does some tracing to find an actor > If finds a valid actor > Sends a Run On Server event passing along reference to the actor you want to interact with (Add an Actor Reference as an Input to the event).
2 Server Side) Run On Server Event > Validates player should be able to interact (player within range checks, not dead, etc.) > Calls Interaction Interface on the Actor
3 Server Side) Interaction Implementation on Actor > Does whatever is required for this actor to be interacted with, set any replicated values, trigger any other events or functions, destroy itself, call a multicast if required, or do whatever else you need it to do when it is interacted with
Hmm, I guess I've to search then and try to figure that out. New topic for me x)
Thank you a lot! I'll try to refacture a lil bit and see how it goes
@dark edge yes?
does unreal have a weird thing with spawning actors in a for loop? I have a shotgun type weapon which uses a for loop to spawn multiple projectile actors, but in multiplayer, the for loop just spawns 2? Ive used a print to check it and its showing me the for loop is working fine but theyre just not spawning
actually, those are only on the server, and just 2 for each client. but this is on a multicast, and the for loop isnt replicated, just the event that spawns
Hello, I'm curently trying to setup a dedicated server for lyrastartergame following these two tutoriasl https://www.youtube.com/watch?v=bw4zDuH3v54, https://www.youtube.com/watch?v=_7TQynJ_TrQI'm . I'm currently on 00:48 on this tutorial: https://www.youtube.com/watch?v=bw4zDuH3v54. However after I set my startup project to UE5 and clicked on the windows debugger, it starts building but its been building forever. I'm hitting my 10th hour without it finishing. This is the 2nd attempt this has happened. Does anyone have any ideas? I need help π - or if anyone knows how to setup a dedicated server for lyra in general, It would be greatly appreciated if someone explained that to me.
Video should get you a working lyra project setup as a dedicated server.
The clients need to run the packaged Game and then use the console command to connect or the blueprint command to connect to the public ipv4 / ipv6 of the pc thats running the packaged Server.
Video should get you a working lyra project setup as a dedicated server.
The clients need to run the packaged Game and then use the console command to connect or the blueprint command to connect to the public ipv4 / ipv6 of the pc thats running the packaged Server.
guess Ill wait until tomorrow
You're going about this all wrong. There should be no real reason for:
A) A client to tell the server to spawn weapons.
B) A client looping to tell the server repeatedly how many weapons should be spawned.
C) A client to tell the server what position to spawn them in.
D) Having each client spawn a copy of the weapon.
The server should be able to spawn weapons on its own without a client RPC, unless of course your client is "Dropping" a shotgun, but that still shouldn't be a direct thing that a client should be able to call.
The server should likely determine the rotation to spawn the shotguns rather than the client being able to arbitrarily tell the server the rotation.
If you do want your client to be able to tell the server to spawn a shotgun, that's fine, but you shouldn't be looping the RPC. Instead, put the loop on the server so the server can do it and if you want the client to be able to tell the server an amount, include an input on the RPC to include a desired number. It's probably not spawning all of them because you're overflowing the network, as you're looping 16 times, then running a multicast 16 times.
If your ShotGun is a replicated actor, you would only need to spawn it on the server, so you wouldn't require to even call a multicast to spawn them, just spawn them on the server, and they'll replicate as they are able to clients.
Oh sorry I see, it's the projectiles...
yeah I didnt realise I made it look that way
Even still, not the right way... Client shoots > Server determines rotation > Server Spawns Projectiles
thats one of the things I tried
yeah, just checked again and changing it to a server event makes no difference
At the very least, you wouldn't want to multicast the spawning of the projectiles, nor should you be sending an RPC in a loop to the server, one RPC to the server should suffice for triggering an activation.
so if the rpc isnt in a loop how is it randomising each spawn rotation without being different on each client?
also it just wont let me spawn actors from the server
You do the loop to spawn on the server. You don't need to loop on the client to tell the server to shoot them individually
Are your projectiles marked as replicated?
which part? it does replicate the two that fire completely fine
and with a different weapon type it was all fine
An actor being marked as replicated is not the same thing as sending RPCs.
A replicated actor means you can spawn it on the server and a copy will then appear on relevant clients.
What you are doing is telling each client to spawn their own actors which would not be considered replicated as they weren't spawned by the server itself.
oooohh man I didnt even realise that, yeah I was sure it should have worked on server
thanks yeah I can do it without the multicast now
this oddly seems to have fixed the for loop thing but now only two of them have collision (nvm, one event was still multicast and setting to server makes none have collision)
I'd still move the loop to be on the server, there's no reason your client should have to tell the server to RPC each bullet for a shotgun as it's more of a burst type effect. I know there are people who do an RPC per bullet fired with automatic weapons, but that's because there is usually a slight delay between each shot.
collision is done with a sphere trace on tick, so that shouldnt need any extra replication should it?
yeah I put it all on server and it spawns correctly now
didnt have replicates ticked on the actor itself
Nice.... As for the sphere trace on tick, that's not really necessary - you could just add a sphere collider and detect the overlap or hit when it happens.
no because theres bullet penetration stuff
Ah ok
otherwise, you just need to make sure the collision is happening on the server using Has Authority
ie. Tick > Has Authority > Sphere Trace
oh hang on, the projectiles are stopping when colliding, but shaking around and fighting over where they should be, just seems to be a desync then, need to replicate one of the scripts I made there
well, now collision works but sometimes a bit too late so it goes into walls slightly, but thanks for the help anyway that loop was the main problem
Iβm have a pcvr multiplayer game I want to have on quest, I normally built server and client through the windows platform but now that I use the android platform how does it work for the server? Do I build it through android?
is net cull broken in editor? i set it to a low value (10k). I walked out of range of another player, the actor dissapeared but when i walked back the actor did not get recreated
The distance isn't in standard unreal units, it's a squared value. So root of 10k would be 3.16 units.
Basically need to be on top of it in order for it to become relevant.
i see, how did you get 3.16?
Default is 225000000.0 which translates to 15000 units
Square Root of 10000 = 3.16
err
100 sorry wtf
Must've had something else in the calculator when I started typing XD
hey guy's if i want to know more about the AWS gamelift then which chanel is good for asking question
hmm 100, let me try further
None really as this server doesn't really handle AWS support.
oh okay then if i ask some of question here then it's small chance to get answer right
but still it's multiplayer channel so expect to get some answer i guess
Yep. AWS Gamelift is a separate service that's not specifically tied to Unreal Engine itself. If you're trying to integrate it with Unreal, then you'd probably want #cpp if you're having trouble with getting it coded. If it's a plugin you're using that you're trying to use, then you'd probably want to hit up the developer and check if they have their own Discord or support channels as people here may only have limited knowledge of that plugin. Otherwise, you can ask, but yeah, might not get a great answer :/
oh okay Thanks bro for information
For future searchers: if you think net cull distance works weird (actor not getting recreated when going back into cull distance), it's because it operates off your camera location, not player actor
Yop to be more precise it works based on your view location. Doesn't need to be a "camera"
A lot of stuff actually does. E.g. there are nodes that calculate AOE Screenshake based on camera internally. Shows UEs ties to first person shooters.
Is anyone knows the best course of dedicated server?
on a listening server is there a way to let the host client spawn a actor without it being replicated to everyone else on the network?
The fact I'm struggling to find info on this is odd, I'm sure tons of people have tried to perform something clientside on a host client?
Just spawn it on server but don't tick replicate and net load on client?
don't tick replicate and net load? where is that?
but I'm also using the same actor to replicate across all clients for other situations
well you said earlier you don'tw ant it to be replicated
not in that scenario no, I think doing this though fixes it
or it appears to fix it
did it?
I think that;'s kinda unreliable. If you add delay it will actually spawn the Actor in all clients regardless
Its not replicating to other clients so yes
if I add a delay it just spawns in its set location
but since its following the users cursor it disappears because thats not replicated to other clients even on the host client oddly.
I mean ideally would not to replicate it on the client period but this seems to be a work around till I can find a better solution. I think running the server as a separate process on the host PC would be the ultimate solution but the most complicated
Just question to understand, does the server need to know that client pressed on key to look around to change pawn yaw rotation?
no, the server doesnt need to know. there should be an event that executes when you press the button and it can handle everything
So the SET need to be in event that will be Executes on server?
it should execute on both the server and your local machine
So something like this? its working just want to make sure this is the right way
yep
how can i get player name correctly?
server normally get name
but for client is None
with delay works
but how can i do it without delay
ok, so Client has Controller and Server has controller, so 2 games == 3 controllers
Client Controller is first when player join to server?
and second Controller for this client is on server
So the characters' controller will only be valid if it's a local controller. The Player State will only be valid if it's replicated + the controller has replicated it's reference to it.
Clients don't receive other players' controllers nor the servers' controller
Characters already have a reference to the controlling player state, so you can just get that. Unfortunately, since this is Blueprint you have no idea when it'll become valid.
thanks
whats best practice for clients shooting projectiles that use projectile movement component? sending a rpc to server to spawn causes a noticible delay on seeing projectile spawn on client, I could spawn projectile on client then send RPC for server to spawn on other clients, but projectiles get replicated to all clients so shooting client would see 2.
What is the simplest delegate/event-based way of allowing a UserWidget blueprint to subscribe to changes (add, remove, change of items) of a UActorComponent subclass's FFastArraySerializer class?
I'm ending up with a lot of delegate code and I'm wondering if there is a common way.
What I'm trying out: the UActorComponent has some kind of delegate or event exposed that the UserWidget blueprint can subscribe to. The UActorComponent then itself listens to changes in the FFastArraySerializer subclass.
you can inject the component as Owner into the FastArray, then broadcast directly from its callback functions
just don't do it in a constructor, and just a non UPROP TWeakObjectPtr<UYourComponent> Owner;
Will an adroid build work on windows server? If I build the client on android and the server on windows, will that work?
Hello, all. I still have not found a good solution for my previous issue of Load Level Instance not replicating and therefor stopping my procedural map generation from working for remote clients. Does anyone have an insight into some other ideas on this topic? Thanks!
MP AI Perception - i'm having a LICK of a time getting this TeamId to set right... wondering if someone sees something i'm not:
1: I spawn AIPawn (getWorld()->SpawnActor()...)
2: I set new pawns Team appropriately (see below ETeam enum)
3: AIController::OnPossess SetGenericTeamId((uint8)MyPawn->Team);
This TeamID is ALWAYS 255 when its going through perception phases.... I"ve even gone as far as setting the TeamId to Replicated - thinking it was an MP Replication issue (shotgun attempt at best...) but i didnt expect that to even work in the first place..... What am I doing wrong? The MyPawn->Team is a value of 1 when it hits that function (3 above) but the UINT8 cast is setting it to 255 :/
UENUM(BlueprintType)
enum class ETeam : uint8
{
Defenders UMETA(DisplayName = "Defenders"),
Attackers UMETA(DisplayName = "Attackers")
};
Did you implement the generic team interface?
And the getter?
AIController already implements that -
class VIGAME_API AVI_EnemyAIController : public AAIController
you maybe onto something...
FGenericTeamId TeamId is set to PRIVATE in AIController.h
All readings i've done they make their own FGenericTeamId in Protected scope in their extended AIController class -w hich i've done...
doesnt this conflict?
same name -
FGenericTeamId TeamId;
I guess? Why do you need it to be custom
If the ai controller has it
Pretty sure they expose it via the interface?
they expose the function publically - not the variiable TeamID
But i'm also questioning if i need to even override this GetGenericTeamId() - i'm not doing anything in it.... i'm going to remove that to see if that makes the difference.....
AIController.h
//----------------------------------------------------------------------//
// IGenericTeamAgentInterface
//----------------------------------------------------------------------//
private:
FGenericTeamId TeamID;
public:
virtual void SetGenericTeamId(const FGenericTeamId& NewTeamID) override;
virtual FGenericTeamId GetGenericTeamId() const override { return TeamID; }```
yah this compiles...
all readings i've done say that you need to override GetGenericTeamId() as part of the interface -
doesnt look to be a required override tho
Since the AI controller isn't replicated most peeps probably have the variable a second time in the character or so
Would need to override the setter in both classes though to keep them in sync
This solved the 255 issue - thanks for helping me think out the box π
Hey, I'm working on creating a voice chat system. How can I disable voicechat for a specific player? Meaning that they cannot hear other players?
I'm using the built in VOIP system
For context: this is for a walkie talkie system. I want players who do not have a walkie talkie in their inventory to be able to receive walkie talkie sounds, only proximity chat
I know it's now what you ask for, but that Delay loop is realllly shitty :D
But that aside, I'm not sure atm you can do that. The default VOIP system has this Mute functionality I think
But that mutes one player for all others
Not other way round
I know, this was just to quickly set things up
Alright that's a bummer, thanks though!
I see thanks for the answer, itβs better for me to ask instead of search online for an answer that I was looking for but wouldnβt work. I will be developing a mixture in that case using the existing cmc system but for vehicles
Like remake the system
Hello, I am currently trying out the multiplayer stuff on the FirstPersonTemplate. Net mode is set to Listen server with two players.
In the FirstPersonBP, I create a widget on Event BeginPlay, promote it to a variable and set it to viewport (its my HUD).
Now, at one point in the game, im using RPC to call an event on all players which changes their HUD (and therefore accesses the saved hud variable in FirstPersonBP).
If my client fires this event, the HUD changes fine on his side. But when it comes to accessing the servers HUD variable, I get an error because it is apparently "None", even though I did set it after BeginPlay and wouldnt know why it is now None?
Can somebody help me with that and explain whats going on?
hello, should the functions triggering safe variables in custom cmc be replicated?
Hud isn't replicated. Show your code
What do you wanna see
RPC on
What do u mean
From the RPC to wherever you do the stuff you do
Alright
The CallFP event gets called from a button press in the HUD
The Print String is already giving me that the variable used to store the widget is None, which later results in an error as described
(event is called by the client btw)
So client presses button in his HUD and fires CallFP
All the screenshots are from FirstPersonBP
This is how the HUD variable is set on BeginPlay, also in FirstPersonBP
Win Shift S
show what's before this
you only want to do that on the local copy of the actor
IsLocallyControlled
This is whats before, just template stuff after BeginPlay
gate that by LocallyControlled
you don't want to do any of that on any copy of the pawn besides the locally controlled one
I put a branch after BeginPlay and checked IsLocallyControlled, but error remains (server hud var is None)
Hi everyone, I am new to Unreal Engine, I would like to know how I can notify the server that I am managing an object. I'd be happy to have any information which can help me.
You probably want to make your paddles there pawns that your player controller then possesses.
Well you wrote the name of the function you should use in a comment and yet you use BeginPlay
BeginPlay of Pawn is cursed to get the PlayerController at
I dont really know what you mean, could you explain a bit more in detail?
Use OnRecieveControllerChanged instead of BeginPlay for this
Literally what the comment their says
It's prolly not yours
I falsely assumed it was, but it feels weird that it's there when it's actually BeginPlay
Its the FirstPersonShooter Template
Yeah so it's on Epic
They did the comment part, but left the implementation cursed π
Using SetReplicates seems to be a workaround to run stuff clientside as a server host
Did that now, the error remains though.
I replaced BeginPlay by OnReceiveControllerChanged
With no IsLocallyControlled?
The one I am trying to fix, where the widget variable of my server is None for some reason
Tried it with and without lol
The widget should be valid if you create it and associate with a local player controller
Nothing really fancy
Its so odd how I cannot find documentation, are listen servers not popular or something?
It seems like after my client spawns, the servers widget variable gets set to None
Well documentation in general is scarce, nothing exclusive to listen-servers
But since you asked, it's not of Epic's interest either
yeah trying to figure out how to run things only on the client when the host is the client isn't easy, I think I found a work around but I don't think its a great work around
Sounds like you're referring to the Remote pin in SwitchHasAuthority macro and wondering why it doesn't fire on listen-server player at all
I mean yeah it shouldn't
You instead use IsLocallyControlled, IsLocalController
And a bunch of similar functions
who are you talking to
You
how would checking if locally controlled help?
Help in what sense?
being able to run stuff on the host client without it replicating to all other clients?
That's literally what you're asking for. You want to run something on the OWNING CLIENT right?
yes. but the host client, is also the server so anything they do is replicated to everyone else on the network
Well they don't really know what they are asking for
Another sad day for the science of question asking
no, only replicated things are
What are you actually trying to do here
I'm trying to spawn a actor but locally on each client so they are clientside
Don't replicate the actor just to begin with
yeah just have the actor not be replicated
And spawn it after the check mentioned earlier
I'll give that a go
Or you can have it be replicated but not actually replicate anything. What's the game mechanic?
Being able to place a actor down but when you select a actor a ghosted version of that follows your mouse, doing what yall said seems to work though
What's the best way to check that all clients have connected and have finished spawning pawns after seamless travel? I want to set something up in GameMode to know when to start the match.
Does someone know more about why that might happen?
There are lots of reasons why that could potentially happen. You could show more code as to how you're handling the creation of the widgets and when you're accessing it that it shows None, preferably showing the initiating event that leads up to it too.
Begin Play fires on clients and server, so if you're creating widgets there, the server and client could potentially be creating the widget when you may only want it for whoever the owner is of that controller or character, or whatever class it is you're using to create that widget.
If you're attempting to access the widget of a client on the server, or vice versa, that's not possible as widgets do not replicate.
I showed all of the relevant code already in screenshots above. I do want the widget on client and server, so I suppose BeginPlay creating it for each is fine too?
Do you mean I am unable to access other widgets except my own through the server? So an RPC Multicast to, lets say, change a text on the widget for every player, would not work? How could I still ensure that if my client does something, the widget of my server changes aswell? (As the widget of the client is doing fine)
Creating on begin play of a character is bad unless you have an IsLocallyControlled check before doing it, otherwise everyone is creating it and if it is just your HUD, you should only be creating it once.
The other problem is that if you're running a multicast on a character, then you're referencing the HUD created for that particular character but since you (hopefully) only created the HUD for the one local player character, you wouldn't necessarily have created a reference to the HUD on the character you're calling the multicast on.
And this missing reference might explain why it gives me "None"?
It does seem like even tho my server does have his hud reference, the client seems to think it is None. But idk
Probably. Each character is its own instance of your blueprint. If you create a widget on a specific instance, only that one instance will have reference to that specific widget.
If you create it on every instance of your character, then you'll have several instances of that widget, each referenced on the character it was created on.
So the HUD you'd create on Character1 would be different from Character2
So calling a multicast to do something with the HUD reference on Character1 means you're trying to access the HUD created on Character1.
I thought itd work like this: the code after the Multicast event will be executed on each players instance seperately, and therefore use their own HUD reference variable as created at BeginPlay
And it doesn't work that way. When you call a multicast, you're telling everyone to execute something on that particular instance.
Okay, thank you. Now, how else could I achieve this? Basically, client pushes a button, and his aswell as the servers HUD change
That is difficult to do when the HUD is in the character as you don't really have a good reference to the local HUD. You can easily get a reference to anything stored on the current player, but to get your own local HUD from a player character, you'd have to do something like, Get Player Controller 0 > Get Controlled Pawn > Cast to your Character Class > Get your HUD reference and do stuff.... It's messy.
This means: Don't store your UI on the character. There is a "HUD Class" that you can set in your Game Mode that gives you an actor that is instanced locally for each player. You can create your own HUD Class, and have the logic in there to create and add the UI to the viewport. You can access your HUD using "Get HUD" anywhere but you still need access to the owning Player Controller, but then you can cast it to your custom HUD class and do what you want to the widgets it has created, but that's still not all that great as you could instead have your widgets read and listen for things rather than trying to push changes into your widgets.
Need a widget to display a player name?
Have an event dispatcher on PlayerState that you call during OnRep of the player name. Have your widget bind to that event dispatcher to read the PlayerName. How does the widget know which PlayerState? You create the widget when a PlayerState joins the game, which you can use the Begin Play of the PlayerState to determine when a player has joined - create an event dispatcher on Begin Play of the PlayerState, have your HUD listen to that event dispatcher, and when you hear it, you can create the widget.
So rather create the HUD in the HUD class and save a variable there? And whenever you need it, get the HUD, the variable, and do stuff?
That would work better, yes, but again, ideally you're not forcing the data into the widgets - the widgets just listen for the data to come in.
Doing it this way means you still need to do "Get Player Controller 0" > "Get HUD" > "Cast To HUD" > Do the stuff.
The benefit is that you're no longer trying to reference the HUD that you've stored on a particular character.
Can you explain why Cast to HUD? I thought if id store a variable of it, I could just pull that out and call events or stuff
I'm talking about a HUD Class.
Oh okay
So within the HUD Class, you'd create your actual HUD Widget.
Yep just got confused with the terminology for a moment lol
Unreal should change the name to "Widget Manager" class π
Why is networking so hard
It's more having to understand Object Oriented Programming and realizing that those objects can exist in more than one place.
Out of all the programming ive ever done, networking was the weirdest stuff to me
It often went wrong when the code looked totally fine
Doing something on a particular Object means that object. Not on others that are like that object. If you want all the other actors of that particular object type, then you have to reference them and ask them to do it too.
Networking adds the additional headache of understanding who is in control of the object, and on which instance of the game you're calling the instruction on.
Its like you do stuff but it gets received totally differently and i dont know why
Yeah in UE5 its not the easies to grasp, but even something low-level like sockets is just...weird idk
Sockets is basically the same thing.
Server is started.
Server sets up timer to only stay active for the next hour.
Server starts waiting for connections.
Client connects to server.
Server stores reference to the client object that joined in an array and sends a heartbeat every so many seconds if nothing is received to know if the client is still connected.
Client sends instructions. Server receives, does what instructed, sends back response to the client object that sent the instruction.
Client receives response back about status of instruction.
Server detects client hasn't send anything in 20 seconds, heartbeat sent.
Client receives heartbeat and notifies server it's still alive.
Server receives heartbeat from client.
29 minutes (and many heartbeats) later....
Client forcefully disconnects.
Some seconds later...
Server sends heartbeat, client object is no longer valid > Server removes client object from array.
30 minutes later...
Server timer is up! Server gets reference to all connected client objects, loops through them and tells them goodbye, disconnecting them.
Server process shut down.
And the worst part is how once it all works perfectly fine on ur local network, u try it on a real wifi and it all breaks down
That's thanks to latency mostly. What my computer sees isn't what the server may see whether we're 5ms or we're 300ms latency away from each other.
The server is always in the future compared to my computer.
Best way to say "hey everyone, possess this specific camera actor in the level" in blueprints? I want all my players to enter the match into a short preround where they can see the map. I was thinking each PlayerController possesses it during Begin Play, but I am unsure of the best way to tell the PC what to possess. If hardcoding the camera actor ref into the PC is an option, that should work fine.
what's best practice to distinguish between a simulated proxy and an autonomous proxy, e.g. when adding components to my pawn that will only ever be active/visible for the autonomous proxy?
You can't really have multiple players possess a single actor (especially if it's just an actor and not a pawn!) You could set it as their player controller camera manager's view target, though, or something.
i can have the same exact class for both, simulated and autonomous proxies, and just disable/hide some components at runtime when the pawn isn't locally controlled. but is this the way to go?
You're right, that's what I want. View target. That slipped my mind, thanks.
That's basically how, say, player mesh vs arms mesh works for things, so why not?
You could even add the local-only components dynamically on begin play if it's locally controlled.
i guess it works ... it feels a bit messy. In theory the locally controlled pawn could inherit from the general pawn and explicitly add stuff
Or add them via the player controller when you acknowledge possession?
Check what the actor's netrole is (Get Local Role and Get Remote Role can help you determine this in Blueprints)
that's interesting, sure. it limits my ability to use the editor to configure the components, though
You're posessing things in the level already? Rather than spawning new pawns?
but well, my question is about best practice: there is nothing wrong with adding stuff and hiding it for not-locallycontrolled pawns. so that's an answer. thanks.
no, but I can use the blueprint view to set up the camera and some cockpit stuff in the editor
Ah. Yeah.
and those cameras and the cockpit isn't active/visible for pawns that are not locally controlled
Not sure about best practices, tbh.
It seems just like a very advanced version of player vs arms mesh, though.
i will organize my code a little bit and address this even by putting comments // locally controlled stuff here: ... to reduce the cognitive load. I wouldn't mind having stuff in two distinct classes - but that is not strictly necessary, either.
The new learner experience of looking back at your code from even just a week ago:
I spawn my players with a for loop, during which I give them a killfeed widget, and I store all the widgets in an array, that I iterate over whenever I broadcast a kill event....
HIII^^ any one know of any good guides to set up multiplayer with google play services? been looking but i cant find anything
Hey, Iβm building my dedicated server on windows and my client with android. Does that work? Or how do you get the server for an android build? Anyone knows?
What quantum computer you got laying around lol
Maybe I should've said my computer is always in the past compared to the server? That way it doesn't break causality!
Indeed x)
What's the common way of doing server logic if not dedicated server ?
seems the server doesnt get onRep's
(which makes sense, but ruins the setup )
i keep on adding stuff like this to 'fix' it but it feels rather dirty
if (GetOwningActor()->GetNetMode() != NM_Client)
{
SkillPointsChanged.Broadcast(GetAvailableSkillPoints());
}
You can just call the OnRep function manually when setting the value on the server.
Still feels kinda dirty, but cleaner than what i got today i guess
What is the absolute first thing I should learn when getting started with multiplayer?
This compendium is meant to give you a good start into multiplayer programming for Unreal Engine.
gives a good overview about the framework
Thank you so much
When should I start thinking about multiplayer?
Seems like something I should consider integrating early
Or is that wishful thinking
i consider myself a beginner too so dont take my advice as the absolute word, but i learned BP programming for about 18 months before jumping into MP
Did you come from a coding background?
no, started with unreal BPs
Okay Iβve only been in unreal for a few weeks haha
maybe try to make a few games by yourself to practice, then start MP.
https://www.youtube.com/playlist?list=PLzykqv-wgIQXompUswD5iHllUHxGY7w0q
i followed this playlist, it gives a introduction about how to use what you learn here https://cedric-neukirchen.net/docs/category/multiplayer-network-compendium in an actual game
I get that haha but sometimes wanting to learn something overrides that safety π just gotta jump in sometimes
I made a 2D open world game onetime in html5/typescript and adding multiplayer after the fact was the most annoying thing I did
its ok that way too but u might have hard time understanding some concepts
Is it a good idea to have interaction line traces to happen on both the client and server?
That did cross my mind. Is there any reason why a line trace on a server wouldn't hit anything but does on the client? I currently have a line trace that happens on both the client and the server but the server side doesn't actually hit anything except for the controlled character (listen server).
The line trace itself it pretty standard.
Yea, i think i've just figured it out. The line trace goes from the camera but I don't believe its rotation gets updated so it never actually hits what the client is looking at.
@whole grove thanks for the help, I just had get the forward vector of the control rotation instead of the camera itself. (as this is what the camera uses)
The line trace is running just server side now as well and all seems to be working as intended.
Can't even comment on why those plugins are awful without the message getting removed π
@twilit radishyou are free to share your opinion, the removed messages were about a behind the scene request from someone to get an illegal copy of the plugin, which is obviously against the #rules
Oh, my apologies if it came over that way. I was referring to the mod ping message that got removed, I wanted to comment on it π
I totally understand the initial message getting removed.
sorry, I deleted my comment because the original message was removed, so it didnt make sense in isolation π
All fine lol. It's not an issue in the first place I just wanted to say those plugins are often massive security leaks haha.
Those MySQL connectors to Unreal / BP plugins yeah.
There are multiple. Not sure which one it was π
Hello, in my FirstPersonBP, I am calling an event through an event dispatcher. This is replicated via RPC Multicast.
In my Level Blueprint, I am binding that event dispatcher on BeginPlay to a custom event. This custom event then gets called appropiately.
Now, when the client calls that event, it all works (e.g. Meshes in the level change), but it only works on his side. How could I replicate this, so that my server will also see the changes and be affected by them (so that their level changes aswell).
(Net mode is Listen Server with two players, using the First Person Template project)
If all you're doing is executing the multicast then my assumption here would be that your client is directly calling the multicast. Clients are not allowed to execute those as only the server may do so. In that scenario just make a RPC for the client to the server and then have the server execute the multicast.
Oh yes I am doing that already, sorry
In the FirstPersonBP, when the event gets called, it first goes to a "Run as server", and then to a Multicast which calls the events in the Level BP
I believe I might have to do some similar replication in the Level BP, but I am really not sure how?
Have you tried checking where it exactly doesn't work any more? E.g. printing messages attaching a debugger?
If the multicast is inside the actual level blueprint it self then it isn't going to work yeah.
The events seem to be binded properly on BeginPlay in the Level BP. And the call to those events through dispatcher in my FirstPersonBP is also replicated with the Multicast like I said. Only issue then seems to be that the actual event in the Level BP which is binded, only fires on the client.
Events binded in Level BP, seems to be replicating fine
Events being called in FirstPersonBP, also seems to be replicating fine
The actual events now in Level BP, only executed on client (not replicating)
Isnt that the only way to change and do stuff on my level?
The level blueprint is not replicated. There's absolutely no way that the multicasts etc. work. Even if it was replicated then the client still would not have ownership over it.
What other ways are there to then change stuff in my level?
Game mode, game state, find all actors of class, anything but the level bp
Use any other actor that is actually replicated. The GameState for example. If this is being used on a specific actor have that actor do the change.
Also this in specific does not seem like something you want to do with a multicast. This seems to be "state" you're changing with them. If a new players joins they will not have the correct state of whatever the light is in π
Yeah, that one
Okay, thank you all very much! Gonna get to work now
when testing enemy ai in multiplayer, how do I know its like - actually working? currently ais can see and target both players with no desync, but like is that just coincidence? does it just happen to work because or do I need to see if theres any problems Im not sure how to even check
and also when shooting at enemies with projectiles, they take damage on both clients, but sometimes only on one if it happened too fast or something, so I would set up replication for the damage events but that seems wrong too because it already kinda works
but Im not sure what I need to do since the projectiles are replicated, but enemies dont always take damage on both clients, but I imagine replicating it could cause it to happen twice or something
oh good start, its already unplayable on the "Bad" preset, cant even jump and stuff even though thats just regular replicated events
good point I didnt think about replicating the actual hit in the projectile
I mean Ive been doing this for years
should I really though lol, seems like every time I do this its as if Im a begineer
but should I expect it to be playable on the bad preset?
Ive never worked with ai specifically in multiplayer
yeah with my other project I was prioritising the clients gameplay and then just doing all the replication separately, but I know this would be horrible for any kinda pvp
but that was custom movement too, with default charactermovement component it seems you cant take any shortcuts like that even if you wanted to
man I hate doing this
on Average you can play pretty much fine but lag behind a lot for the other player, even though this is mostly default movement stuff
at least it doesnt seem to completely fall apart
this is one thing that never seems to get easier 
With Rider, if I launch my game in Debug (so the debugger is attached), I can obviously stop on breakpoints etc if I play the game in the editor.
And if I launch a second player from within the editor I can also stop on debug points when it is "run under one process = true". But obviously I really want to test it as seperate process. So I change "run under one process = false".
This spins up another process, and in rider I select "attach to process" and select the new second client. Rider says Debugger attached to process 6752 - Debugger detached - so it seems like it should work.
But the breakpoints are not working.
What am I missing?
Is there a better way to debug clients and listen servers as seperate process?
How could I make it so player 1 spawns in a specific location, as well as player 2 doing the same but in a different location?
just place playerstarts 
no no they spawn on each other and player 1 for example doesn't always spawn in a certain location
Add a tag to them, and override ChoosePlayerStart in your gamemode to use specific ones with a given tag
So on event begin play on the player set tag to player state num
No. Override ChoosePlayerStart in the gamemode, and search for a player start with a specific tag.
E.g. "Player_1", "Player_2" etc.
Not 100% sure ChoosePlayerStart is exposed to BP but it might be
I don't think this is it
I already have my default pawn class set
I'm just looking for a way to spawn a certain player in a certain player start
Is it not this?
Now I got the following problem: Through an RPC Multicast in my FirstPersonBP, the event is being called on my GameState. This event gets executed properly for both client and server, and involves deleting an actor. The actor is deleted for both players, but at the end, im getting an error in my GameState, saying it accessed None trying to delete the actor (that has already been deleted for both players?). Does someone know what might be going on?
You wouldnt RPC multicast a delete.
You get the server to delete the object, and the object itself is is replicated, so the server will tell the client to delete it via replication
Maybe @sinful tree could help with this?
@grand kestrel I just noticed that the Movement Comp example doesn't really have a proper MoveContainer example or?
Neither ServerResponse nor ClientMoveData
Believe it or not, the level BP is replicated by default, so you can theoritically multicast there just fine
Sorry what
The one useful thing for the thing that should never be used.
Why. Just why.
Haha, yeah it's just w/e
I was never able to find an answer on to why it needs to replicate, but it's missing all the elements an actor needs to be replicated
I bet it was always like this since 4.0
It's not even an actor though. The level Blueprint "self" is an ULevel.
π€
I mean I guess that does make more sense now that I think about it.
But still. Whyyyy
π
My only theory is that it was used for scrubbing in UT and they had some replication code that they needed to carry over to the DemoNetDriver
But that's just theory
A game theory! See you next time.
Alright sorry had to do it π
But yeah.. Even then I still wouldn't use it. It's just an awful way of doing things lol.
I argued if I could turn off replication on it, but it could break things, and I'm not ready for it
I just the LevelBlueprint once
And for that I extended it in C++
And that was because the Game had different settings per Level
So I placed the Settings in the LevelBP
It worked and kinda made sense
But that's all I ever needed it for, aside from debugging
And you might be able to just use WorldSettings anyway
But I think I didn't know about that back then
Either that or accessing specific level actors for w/e reason or some level sequence stuff
But yeah I find it rare to need to use it
The good old classic "This isn't documented so I could 'technically' turn it off but it may break things quietly" π€£
Are you testing your multiplayer game in unreal engine?
Make sure to also test conditions where not all clients are joining at the same time!
You can easily do that by enabling the "Allow late joining" feature ππ₯
#unrealEngine #gameDev
131
This is a particuarly awesome feature. I was just testing it out now, works brilliantly
If I start a RootMotion Montage in the CMC, while making sure Server and Client have the same Transform, should that cause corrections o.o
Hello, how does connecting and all that stuff work with Listen Server? If I press play now, it just spawns me and my client in, but how would I do things like, setting up a menu where you see servers or can create one, and then spawn, and another person can see that server, connect, spawn aswell? Does anyone have resources on that?
Hi, Does anyone know about if we want to run a timer that is synced between both client and server what will be the best way to do it and that way should be cheat proof also?
Idk about cheat proof but I run the timer on the server and give clients the handle
If you want to see a List of Servers that are hosting, then you need to utilize an #online-subsystems (like Steam or EOS) and utilize Create/Find/Join/Destroy Session(s), where a Session holds the information to connect to the Server.
Without an #online-subsystems you can only connect directly to a known IP and the host has to open ports.
That would be enough. Do you know some resources or guides regarding that?
What do you mean by giving handle to clients?
Not really, google is honestly your friend here
session search result is always empty. anyone have any fix?
UE 5.2 / STEAM
sessionSettings->bUsesPresence = true;
sessionSettings->bUseLobbiesIfAvailable = true;
Both lines already there.
Able to create sessions but when trying to find sessions it is always returning 0 ( Checked in debug and as well as build using debug write on screen )
Image
SCARBLAZ β Today at 9:26 PM
am testing on 2 different laptops, different steam accounts but on same internet network. idk if this is helpful
can anyone help?
Alright, thanks!
You can host a game with the OpenLevel node and passing ?listen in the options. (if a Player should be able to host) or you need to build the Engine from Source (gitHub) to build a standalone DedicatedServer for your game.
If you have the IP and the Port is opened properly, you can either use the console (for debugging) or in BPs use "ExecuteConsoleCommand", where the Command is open <ip:port> , e.g. open 127.0.0.1:7777
When you use a set timer node it outputs a handle object. This is basically a reference object to the timer. If you give it to clients they can see what the timer is doing (time left/passed, is paused, completed, active, etc.)
Got it, thanks @sudden condor
Hey nice ppl, i have a question about multicast and rep notify, not quite sure if i should post it here or not, so I'll describe my question fast and if it should not be here i would delete the post.
It's about the rep notify and multicast event related to the networking example regarding the treasure chest.
https://docs.unrealengine.com/4.27/en-US/Resources/ContentExamples/Networking/2_4/
So based on this explanation, multicast event would be used to play effect, while the rep notify variable will be used to make the chest stay at an opening state.
This is all good. But in my scenario, there is a rather complicated "chest open animation". What i would like to have is:
- When the player first opens the chest, play the effect and this complicate animation;
- When the player comes back (become relevant), make the chest "open" immediately without the complicated animation.
It seems logical to extend the multicast event to play both the animation and the effect. Yet since the rep notify happens as well (almost at the same time when the multicast event happens), this rep notify would somehow force the chest to stay open, which seems conflicting with the multicast event where it wants to slowly open the chest.
Is there any good way to work around this conflict?
you multicast the animation
once it finishes
you onrep that it is open
otherwise you have conflicting code
so first the multicast happens, the chest opens
to keep it open forever, you set some variable that is onrep to open
Make sense
but first you wait for the animation to finish
guys anyone have idea of this issue??
You can make that a bit more complicated by skipping the OnRep result if it means the Chest is open while you are playing the open anim
Cause it might just replicate faster back and the anim is suddenly skipped
a lot of lazy devs would just keep it an onrep lol
since honestly, you load in, all the chests in your relevancy range open
but it happens while loading, which is how a lot of games just don't care and leave it like that
If you walk out and into relevancy range, you'd notice it though
depends
usually it's high enough that well, you don't really care
example: not really networked but in baldurs gate 3 this happens
it plays the animation still
right as u load the last save
Yes. The actual case for me is that my chest is not really a chest, but a collapsing rock where i kinda want to let the playdr watch the animation in the first run, but don't play it again when next time the player approaching
Does anyone have suggestions on why OpenLevel works for Host but not the Clients? Clients most of the time just timeout, so I'm thinking that the host needs to do something before the clients are notified to load level.
What are you doing?
And what are you trying to achieve
Hey I've noticed that on my dedicated server in the session settings my build ID is 0?
doesn't this correspond to the project version?
Host creates a party, others players join the party, then the host initiates a CreateSession() and load into a "Lobby" level with a widget selection
Pulling the other party members into the level as well
Why create 2 types of session?
Surely a party is just a session that hasn't progressed to a lobby?
Yeah I'm not too sure about that. Most of the code I'm working with isn't mine
great chance to correct that idea and just have everybody join 1 session
I guess it could make sense if there's the option for randoms to join your lobby, like CoD or whatever.
That is the idea, that I am going for
That's a pretty involved thing
MainMenu Parties, like OW, CoD, CS, FN, etc. are done with BEACONS in UE
Which require C++ unless something changed
They are lightweight connections that don't actually join a level
They use PartySessions (which are different from GameSessions in theory)
And if you use something like Steam, you can't actually be in both at once, so you also have to manage recreating the Party afterwards etc.
If you don't want to deal with that, you'd only have the option to actually connect to a Level (e.g. a Lobby) and then SERVER TRAVEL (seamless!) to the Gameplay Level
OpenLevel isn't used anymore after connecting unless you want to disconnect.
Server needs to call ServerTravel <mapname> to take clients with it
Hello, in my GameMode, on PostLogin, I am casting to the GameState and run an event. This event on the GameState checks if two players are connected, and then does stuff. This functionality is only happening on the server though, and not replicated to the client. Why is that the case, and how could I still achieve the desired functionality? I suppose it doesnt really work because the GameMode only exists on the server? But I would need PostLogin to check the amount of players whenever a new player joins, or are there alternatives?
Hey everyone! How do I enable seamless travel in PIE? I need to use PIE for a plugin I am testing with multiplayer. I see this warning:
LogGameMode: Warning: ProcessServerTravel: Seamless travel is disabled in PIE, set net.AllowPIESeamlessTravel=1 to enable.
But when I enter it, I get a warning that 'set command cannot be used in editor' so is there just nothing I can do?
You could try calling "execute console command" in code
Why do you need PIE when you can just launch?
This travel works, but "copy properties" isn't being called in the PlayerState. I got this indirectly from a guide so I feel like it should be able to work.
That's what I did to get the original error
ah well idk then
I am using a plugin for multiplayer and it only works in PIE I guess. Unless I package and build but I don't want to do that for every test
You can launch without having to package
Try playing as standalone game?
not much slower than PIE
You can even launch your game from a shortcut that does something similar without packaging.
Target:
D:\UE_5.2\Engine\Binaries\Win64\UnrealEditor.exe "path to your uproject file here" levelnamehere -game -log
Start in:
D:\UE_5.2\Engine\Binaries\Win64
Change the path to Unreal based on where you installed it.
Okay I'll try and figure out how to do it with standalone. Thank you all!
yeah i love doing this for testing
Can someone educate me on this?
You can use BeginPlay of PlayerStates on clients to know when a player has joined the game.
You are correct in that GameMode only exists on the server, so when PostLogin is called, only the server is executing all the following code.
The alternative is to have your GameState function be called as a multicast - the only trouble here is if you're using playerstates at all then there's no guarantee that the playerstate of the joining player has been replicated when you receive the multicast.
When switching levels, at what point can I be assured that this call will yield a non-null value in the PlayerController?
https://wizardcell.com/unreal/persistent-data/#gameframework-objects-creation-order-and-calls Useful reference for this
Whenever that Camera Actor is created. If it's something placed in the level, then it should be accessible immediately. If it's something that is spawned, then it should be when it gets spawned, unless it is replicated in which case then when it begins play on a client.
It's placed in level (should have said that), but I still get a bad value even when I wait until my client receives it's replicated PlayerState
If I tried this correctly, replicating my event in the GameState as Multicast, and calling that event from my Gamemode, does not fix the issue and still only works on the server.
Also the game mode appears to be invalid at the same time, but I'll have to do some more investigation to see if that's just user error (probably is)
The GameState exists for everyone though.
GameMode only exists on the server, you can't access it on clients.
And I'm testing it myself now, on begin play of player controller, getting ref to a placed camera actor is valid on client.
That works when I play the level directly, but I'm having trouble when I'm loading it from the lobby. Not sure if the situation was clear (my bad) but I am transitioning to a new level when this happens.
You're probably running into another problem in that the GameState also needs to replicate to clients.
So calling the multicast before the clients receive it, which can happen on PostLogin, would mean the client wouldn't get it.
A little weird it lets me call this in the controller then. Guess I have to access it through the state?
You can call it but that doesn't mean it'll give you anything good
PlayerController exists on server and owning client
Yeah, the editor should probably say something about it though lol
How could I prevent this?
It's a static funciton meant to be accessible anywhere in your code - it's an ease of use kinda thing. A player controller doesn't mean "client" as that player controller will exist on both the server and the client, so depending on when you call that function (ie. running on the server) it can be valid.
Miata Onrep
Is
Always
The
Answer
Still having trouble over here though
Same thing... Using servertravel, player controller still gets a valid reference to a placed camera actor in the level on begin play.
Besides always checking the playercount on PostLogin (or maybe OnPossess), how could I make sure that a certain event does not fire on BeginPlay (when the first player joins), but waits for the second one?
Weird...I am definitely using server travel though.
You use postlogin for the server to know.
The server can set an OnRep as adriel said which should probably be in the gamestate, that onrep can then drive the logic on clients.
It can be a simple bool, "PlayerLimitReached" -> Set true -> OnRep fires -> Things happen
Can you guide me to some resources on OnRep? Never heard of it
Lots of pins in this channel that go over it.
It's a means for a variable to call a function when it receives a new value, usually when a replicated value gets received.
You can mark a variable as OnRep by setting its replication setting to RepNotify - doing so will automatically create a function in the class that will be called when the value changes.
You can put whatever logic you'd like in the OnRep function, including doing anything based on the new value of the variable.
This also lets you drive stateful logic, meaning you can set the value before the client knows about the actor that contains it, but when the client finally does know about the actor, they'll receive the replicated variable and the OnRep will fire, causing the logic required to execute when received.
Just like standard replicated variables, you need to set the variable on the server if you want all clients to receive the new value.
Thank you very much, its working now :)
I have an rpc set up that plays a anim montage but there are constant desyncs that happen
this was from a dash root motion montage
is this fixable???
First time trying out multiplayer but having trouble playing my test level. When I set the net mode to play as client (expecting a dedicated server to start up) then I get an error message pop up Couldn't Launch PIE Client If I try running in listen server mode it launches as expected when there is only one instance but If I try playing with two clients I get the same error message. Anyone have any ideas what this could be?
Hello, is there any way to be able to host a game on my PC so that another client can connect to it/join me, without me having to forward ports? I am sadly unable to do so, therefore I would somehow want to circumvent it. When I did some networking in Python, I used to host a server via ngrok. Is there anything similar I can do here?
You need to do NAT punchthrough somehow, typically that's handled by Steam or EOS or whatever
This is likely the bit of code that is throwing up that message, and it's from the GameInstance.
if (EditorEngine->Browse(*WorldContext, FURL(&BaseURL, *URLString, (ETravelType)TRAVEL_Absolute), Error) == EBrowseReturnVal::Pending)
{
EditorEngine->TransitionType = ETransitionType::WaitingToConnect;
}
else
{
return FGameInstancePIEResult::Failure(FText::Format(NSLOCTEXT("UnrealEd", "Error_CouldntLaunchPIEClient", "Couldn't Launch PIE Client: {0}"), FText::FromString(Error)));
}
The if statement sounds like the engine is attempting to travel, but its failing.
Have you tried restarting the engine and your computer? Make sure there isn't any VPN stuff interfering?
Thanks @Datura, I've tried restarting the engine and double checked VPN is not running but still got the same error message. I've managed to get a bit further by disabling the Run under one process multiplayer option in the editor preferences. I can run in listen server mode with more than 1 client but it takes forever to load the second client, not sure what's stopping both clients from running in the same UE process π€
@sinful tree To elaborate from earlier, here's how I find my camera in the world. I can confirm that if I place a one-tick delay before the "get actor" it works perfectly. Might just end up doing it that way if there's no simple solution. Idk why yours works but not mine.
How could I do that? Are there any other solutions maybe?
No reason to pass "Get Game Mode" here. You can just call "Get Game Mode" in the controller.
You're also doing this a bit oddly as you're crossing whether you're wanting to know if its the server with the remote activation, so then a local playerstate could potentially be calling "Initialize Tank Player" when you maybe don't intend for them to be doing so?
I can't really comment more on the setting of your camera variable there - You'd need to show more of Initialize Tank Player function seeing as you're potentially setting that variable on both server and owning client.
I thought we had this whole discussion earlier as to why I shouldn't be calling get game mode in the controller :P
You can call Get Game Mode anywhere. A player controller isn't a client. It's an actor. That actor can exist on the server and the client.
GameMode is also an actor, but it can only exist on the server, so if you attempt to Get Game Mode while running on the client, it will always return null.
Yeah I just thought it would be easier to pass it in and avoid any ambiguity
There's 0 reason to pass it. If anything it'll probably confuse others as you're indicating that there could be some Game Mode requirement to the function, but then you're also calling that function on a client in which the game mode cannot exist.
Here's the whole event, not sure how it's relevant though. Unless you mean the event settings. I know it's shitty lol but I'm trying to figure out this camera thing before I clean it up.
And here's part of the problem...
You're calling this on a client, Game Mode will always be none.
So if Game Mode is none (which it will be on a client), the cast fails. The cast fails, you're not properly getting your actor variable set on the client if you're attempting to access the variable on a client.
I have some hud effects for when my players hit an enemy, but how do I reference back to that hud in multiplayer? when spawning the bullet projectiles, I got the instigator and set that as the player who fired, and got the hud from there, but its invalid in multiplayer
I thought these were actions that the server didn't need to know about, I'm only sending info one way. The cast isn't failing if I send it as an arg, but the camera still screws up.
So do you think it'll resolve if I run on server
Game Mode only exists on the server.
You are calling the "Initailize Tank Player" event on both the server and the client.
Only the server has a valid object it is passing into the cast, so only on the server it succeeds.
I'm not sure. Honestly I've been using it for a while and haven't had to touch it in a long time so I've almost forgotten what's there π Is there something you want to PR maybe?
Red Line = Server execution path
Blue Line = Client execution path
I understand all this, but I'm not grasping how it affects the camera. The camera is being set, just a bit too early. And as I understand it, setting it on the client's state begin play would set it even earlier.
Your issue your saying is the variable is set to none.
It's not being set to begin with.
Only on the server is it being set.
It is set if I delay it one tick, like I said
This code I sent works. It's just shitty.
π€ Created a brand new blank project, changed nothing and straight away got listen server mode running with 1 host 2 clients no problem so there must be something wrong in my project.
It cannot work in multiplayer. For clients calling this event, it stop here. Nothing beyond this gets executed on a client.
Oh I see. Thanks.
so how is generally the best approach to reference the player that caused damage from a bullet actor
Not passing in the GM makes binding the killfeed event kinda ugly though. Oh well.
Instigator pins
yeah thats what I did
Then I don't see your question
cast to thirdpersoncharacter from instigator, got the hud from that, but its invalid in multiplayer
I said that
And that's also because you're running into the problem of creating UI while running on the server for that particular playercontroller which you probably don't need to do on the server.
Ah my b
Yeah I've been moving everything into the HUD class bit by bit, but I was hoping I could get this working first. Guess I was putting the cart before the horse though.
You shouldn't be grabbing other people's HUD in MP. Just cast to the character and then run something on the character to interact with the HUD.
...that is a good point
It's basically the same mistake I'm making right now lol
So I guess you're trying to make like a hit indicator to signify that the bullet the player shot hit an actual target?
You'd pass the character that shot the bullet as the instigator on the bullet like you said you're doing.
Create a "Run On Owning Client" event in your character - I'll name it "TargetHit"
On Hit In Bullet, cast the instigator to your character class > call TargetHit > Have that grab your HUD and make it display what you want.
Fixed π€¦ββοΈ No idea what was going on, ended up deleting all built files leaving just the Content, Source and Config folders then copied over the newly generated uproject file to my existing project (I disabled quite a few plugins in my project). Worked as expected after that, not sure which of the two was the problem (disabled a required plugin or bad binary/cached data.
I just did that, but now it STILL wont get the hud, even doing it from the player itself, yet only multiplayer has this problem
this even should have nothing to do with multiplayer I dont get it
Your PC can't get its own HUD?
not in multiplayer
I was hitting this a few days ago. HUD isn't valid at PC Begin Play.
When talking about the HUD in that document, WizardCell is talking specifically about the HUD class.
Creating a widget and calling it HUD and adding it to viewport on beginplay of PlayerController is fine, but you should make sure it's only being created on the owning client playercontroller.
Crap I didn't notice he was using a widget, my b
Using a HUD is useful though because it compartmentalizes all the graphics code into one place where you don't have to see it all the time.
and it's only run when/where needed
I never even knew that was a different thing
how does this make any sense anway, its literally adding the hud reference to viewport, so it clearly cant be invalid
Try printing the value of HUD using the "build string (object)" node at various places to check its validity. Unless you know how to actually debug in BP, then do that instead lol.
yeah I tried that, it just gives me the name of it as Id expect
even when running the code for the impact?
Show the rest of this
none of the rest is to do with the hud its other begin play events
Important detail :D
Just show it, I bet it'll show the problem
seconded
or show where you're getting the invalid ref rather if not there
Show
Event -> ??? -> Set HUD
Event -> ??? -> where it shits the bed trying to get HUD
yeah its specifically on an event that just calls an event on the hud
I'm betting it's some event that is running everywhere but the HUD is only valid on owning client
literally just this, but its called from replicated bullet actors. the event still goes through fine though, but just invalid hud
So that event is called on all machines?
only to the player that fired the bullet
Yeah, try setting that to "run on client"
I did that, same thing
dang well I'm out of ideas
If you print the value of HUD how many prints do you get
just one "server: " which is why Im wondering if its because its called from serverside bullets
what's that
What's the key to making gifs work on discord lol
idk i just click the gif icon here --------------------------------------------------------------------------------------------------------------------------------------------------v
only valid if you're on a tiny monitor
Multiplayer Hit Target example that DJ L3G3ND is trying to do.
I cant see any real differences with mine
Since you have the server printing then you obviously aren't doing something right since it should only be running on owning client
You're not running the "successful hit" as Run On Client.
I did
you can do clientside hits if you want
Bullet:
Hit -> LocalPawn = Instigator? -> yup -> tell it to show some stuff on HUD
Keep doing it?
We really need to see the entire code flow to get an idea of wtf is going on, this is like trying to fix a car looking through a straw.
My guess would be that you're calling a "Run On Owning Client" event within the bullet itself rather than on the Character that shot the bullet.
nope
the bullet gets a reference to the player to call its event, but the bullet itself is like serverside or something because I think it has to be
To call what event?
that one in the player
This one?
yeah
You've marked that event as "Run On Client"?
doesnt make a difference but yeah
It does make a difference if what you're trying to do is replicate something from the server to the client.
Without it, the server is likely executing it, in which case the HUD is probably invalid.
no but Im saying it still fails and does the same thing
I dont even know how
wait I changed something in the bullet itself which may have fixed it
weird, I still cant entirely tell why its like this but
I put it into another run on owning client event on the bullets but I dont know how thats working because who is the owning client in this situation?
Each player with their own version of the bullet
I believe
weird, because that was already happening on every players screen
Whatβs a good intro tutorial to multiplayer
Try to make a button that opens a door, without tutorials
...thats not multiplayer related in anyway, whatsoever?
and I asked for a multiplayer tutorial people like. did you not even read the msg?
Stop being rude
he meant in multiplayer...
like to replicate it
Iβm so sorry for misunderstanding
I would need to come up with a proper example. But both MoveData for custom data the client wants to tell the server about and ResponseData for Corrections is important imo
I'm not even sure if the repo uses ResponseData to correct the Stamina on sprint or how it was done again. Would need to check. I think all examples use the compressed flags which is the easy version haha
its acc harder than it seems
it teaches you server and client stuff idk
Yeah Iβve heard of replication, itβs basically 90% of multiplayer
Bad replication = bad game
do you find an answer to this?
did you ever solve this?
can any one help me figure out this problem?
Issue: Steam OSS Find Session Result is always empty. (0) Please find the image attached for visual of Debug values. Details: Engine: Unreal 5.2 Project Type: C++ Online Subsystem: Steam Steam App ID: Default 480 ( Space War ) Objective: Be able to join steam session using online multiplayer in Unreal 5.2 C++ Current Status: Able to cr...
hello, im moving my actor on client and i want that change to be on server and on client as well. if i use run on server event the location change only happens of server, and if i just call the func obviously the server doesnt get anything. i looked at multicast but it says i need to run it from the server
is the only way to do it just calling the fucntion 2 times, on server and on client?
Mark the actor as replicated. Setting the location on the server will then update on all clients.
Assuming the actor was spawned by the server or placed in the map.
Yep. The location then needs to be set on the server, and it should change for clients as well.
Mark it replicated. Nothing to it
Note by default it can only replicate 64 explicit tags max.
If you have larger containers, you need to change the default in UGameplayTagsSettings
@chrome bay My data asset is on my asset browser, I am just passing it as a argument of the method
yeh kk. That should also replicate fine
TL;DR anything you store as an asset in the content browser is resolvable for replication, so any of those should send via network without problems
Going back to your first message in the extremely busy CPP channel, one benefit you might get from the map of tag->anim sequences is tags will probably replicate using fewer bits than a net GUID, so you might get some small benefit doing that.
But you have to opt-in to that behaviour in the gameplay tags project settings (enable fast replication or something).
Should really be on by default, but for whatever reason it's not
But really, my only point was that UObject refs are cheap to send - so if the issue was an optimisation one, DW about it too much
@chrome bay it worked, thanks a lot
Wow, this is a TIL!
And I was just looking on a container I was recently working on and it can potentially have up to 63 tags as of now π
how and where to learn Unreal Engine?
I know right.. I mean I get why, but man.
Talk about subtle details
Jambax saving Wizard without realising it π
If you want to get started with multiplayer in specific take a look at the pinned messages. There are some great resources in there. If wanting to learn Unreal in general I wouldn't start with multiplayer.
if an actor has bunch of replicated variables and RPC's but the actor itself is set to Not replicated, are those variable still going to replicate and RPC are gonna tax performance?
what is bad if someone is using AActor as data for inventory items and C++ UStructs for BP Datatables in multiplayer game?
Hey for some reason the hello print string on the multicast only gets fired on the server when the "UpdateChat" gets called on the server, however it does get called on both the client and server when the "UpdateChat" is called from a client
Variables won't replicate no. If the actor is statically resolvable, RPC's may work.
this is all on the playercontroller btw
Multicast doesn't make sense on Player Controller. PC's are only replicated to their owning client. BTW AGameMode::Broadcast() exists for messages, but isn't exposed to BP by default. A tiny bit of C++ would allow you to expose it.
so in my case i used a plugin which is multiplayer ready but i dont need the multiplayer part because the game is single player, is it safe to use the plugin as it is or should i remove turn OFF those replication on variables and Disconnect RPC's to save some performance.?
Won't make a difference
ok, thanks
thanks you very much
Just try and don't start with multiplayer
in some only MP frameworks if we start as non-multiplayer , the editor will crash
Which is kinda the fault of the person who coded that framework
If anything I'd expect the opposite
eg: if our jump logic is only running from the server to clients on multicast and not listening for if locally controlled, pressing jump key will crash the editor
and honestly I like this Idea, the mp game should only work on multiplayer
That's not a good idea. What if you're making a game with online + offline play?
I'd fully expect single-player game to crash a lot of attempted in MP, but not the other way around
I will build offline version seperately
But you can't if they are the same game
from scratch
Just make the MP code not crash, it's far simpler.
If anything MP code should be less likely to crash because it's stricter
combination of single/mp game is a good idea, but it will make the code bigger and stressful
@chrome bay I wouldn't argue, That's lost energy :P
Yeah, TL;DR, disagree
hi
i try spawn Niagara from Actor on the map for everyone
when the player collide with the actor then it should spawn niagara but it doesn't, it only happens on the server which is weird because the code is run on the server then multicast but as i printed what happens after multicast is just a print string is on the server
someone can help?
i not spawning actor
i spawning niagara system
in actor
do it on rep-notify
when i check Reliable
hey guys can someone help me make a easy kill count?
or if you have a video is the same thing
you need a variable on your player state, determine the bullet you spawned and it hit other actor, if the other actor health becomes 0 , kill that actor and ++yourvariable
int32 killcount;
oh ok
and you can show that variable data on the screen in a widget if you want
okok
Matt aspland has got some good YouTube videos on ue4
but when overlaping actor, then run this only on server
i want run this for everyone
but multicast don;t run for everyone
so why not replicated this system
Hi all, when I place a replicated actor in the world at edit time (not spawned at runtime), is the server or the client the owner of that actor?
this is projectile
projectile is REPLICATED
Movement also is replicated
someone can tell my why Print String is only on server
?
if i set multicast to Reliable
then is ok
but it should work for everyone anyway
without Reliable checked
call multicast on server function
It may be easier if I explain what I'm currently trying to do. I have a simple level with 3 replicated actors, the actor has a cube component that when clicked simply toggles a replicated boolean on the actor (rep notify). In the on_rep callback I'm updating a property of the cubes dynamic material (toggling brightness on/off). When I click on one of these cubes from the host I can see the cube brightness toggle on both the host and clients but when I click on one of these cubes on a client I only see the brightness toggle on that client. Do I need to bring in an RPC for this to work?
doesn't work
all is call on server side
yes
server call to multicast event
i seee
all actors are default owned by server so clients can't change any replicated info on them
i run on server
call server on overlap function and server will call multicast
oh sorry i was responding to @haughty estuary
This is the current result with just a simple replicated boolean and toggling the material param in the on rep callback. I've tried a messing with a few variations of setting up an rpc but couldn't seem to get desired behaviour. Any tips on the flow to make this work from both sides? (both server and clients should be able to toggle the same cubes)
client will need to tell the server to do it, and server will do it for all to replicate
you need a client -> server rpc to tell server to change the bool
on-rep a state bool will be the best choice
so in your function that gets called when a client clicks on a cube, instead of setting the replicated variable directly, make a new event and set it to Run on server, and have the client call that event function instead of setting the replicated value directly
also you can't do that in the cube. Gotta do it in a thing the player owns, typically either the playercontroller or pawn
im pretty sure clients can call server RPC's on stuff they dont own
its client RPC's that need that
without "reliable" checked its not expected to always work
so make it reliable if you want to make sure it always works
nah don't think so
go try it
The RPC has to route through an owned actor. After it's on the server the logic can do anything since it's in the serverside version of the actor the RPC got called through.
PlayerController/Pawn:
Input -> Run on Server Event
Run on Server Event -> change the replicated variable
Cube:
Onrep -> do the thing
oh i guess i missed that since i only call RPC's on things i own lol
- Onrep will save them performance I guess
Hi. I have a question about time dilation. How should I replicate it? It seems like the rate of replication is lowered on the clients when I slow the game down. It makes movement very hitchy. While I slow the game down, I accelerate the players so that they move at normal speed. I also manually set the right dilation on the world and all players on all clients.
Sorry, got dragged into a call. I believe @dark edge is right, I did some debugging earlier with different RPC methods and the cube actor would never execute the server rpc (unless it was the host). The RPC has to route through an owned actor. After it's on the server the logic can do anything since it's in the serverside version of the actor the RPC got called through. this feels like it's going to be the solution I just need to figure out where/how to call that server rpc (there's no pawn available so I'll test it out on the controller first and see if I get anywhere)
Actor should be destroyed always from Server?
I think you can call server RPC on the cube actor from the client if the client is the owning actor
if Actor was be destroyd on server then client still have copy?
probably not the best solution, but you could stick the server event into the Player Controller class and have it take the cubes Actor object as a second input
@dark parcel yes, that would mean the hosting client can click the cube and it would run the rpc (on his machine since he's running the server), however from the client that isn't hosting they don't own the actor so the server rpc will not be executed. I'm just trying to change it a little now so that the click event in the cube gets an object owned by the current client (controller) and calling a server rpc from there passing the clicked cube actor along. I'll also try doing the same from game state, I think that feels like a better place for this rather than controller but could be wrong π€
You probably don't want to do stuff from the client outside the pawn and controller. It will open ways to cheat
Yeah I could get hover event on cube actor to work on cleint side but I need to set the ownership first
ok, is it normal that sometimes niagara shows up and sometimes not? always shows up on the server
just show your code
from whatever event triggers the thing all the way to the bit where you spawn the niagara system
I make a name system for lobby but I want to see players name in game if I bring the crosshair on other players name how can I do it
this is Actor
if hit player then spawn niagara
for everyone
if server
do important logic
In what case do you want it to spawn the system and on which screens?
What mechanic are you actually trying to implement here.
I want it to spawn in everyone
You want the particle to spawn attached to which pawns on which machines?
You want to see the XP on the instigator's pawn only or on everyone's pawn?
Make a multicast event GainedXP in your pawn class
have THAT show the particles
When the hit happens:
Hit -> Authority? -> yes -> call Instigator.GainedXP -> do other server-only stuff
I thought about it too, but sometimes what I showed in the picture shouldn't work?
What you showed in the picture is all sorts of fucky
xd
ok, and multicast on actors that the client doesn't own then doesn't make sense
yes?
Here's what your code is literally doing:
Hit happened -> check if you hit the instigator (?????) -> cast the hit actor to Character (you already know it is because it's also the instigator) -> spawn a particle system -> authority switch for some reason -> run on server RPC for some reason (you already know you're on the server version from the authority switch) -> unalive self
The SERVER version of that actor is making the call
only server can call multicast
You want to do it this way so then anything that grants XP can just call this
In fact you'll want 2 events:
GrantXP (this is just a normal event)
OnXPGain(multicast)
Anything:
??????????? -> Has Authority? -> call GrantXP on some character(passing in the amount of XP granted)
Character:
GrantXP -> do xp logic -> call OnXPGain(multicast)
OnXPGain -> do the visuals and sound etc
Thanks for the feedback everyone, it works as expected though I'm going to keep experimenting some more, not entirely sure it's the best/correct way yet but it does what I set out to achieve so that's a win π€
The one piece that doesn't feel right is getting access to the player controller from the cube actor, it uses gameplay statics get player controller which requires an index but after starting to read this document that might be a bad smell later down the road. https://wizardcell.com/unreal/multiplayer-tips-and-tricks/#2-beware-of-getplayerxxx0-static-functions
why is the cube talking to the PC?
PC should talk to cube
This was the final result. The part I was struggling with was getting the cube actor to call the server rpc but the hint from @dark edge The RPC has to route through an owned actor. was key to getting this first multiplayer test working!
So that's just to use the ActorOnClicked event
not the worst but also not great, you could also do it from the perspective of the PC
PC:
Input -> figure out stuff (which cube if any, etc) -> call run on server event
run on server event -> ??? -> end up with something changing the bool
Cube:
Onrep_bool -> change stuff
If you have a bunch of stuff, not just these cubes, I'd probably start it from the PC
I'll have a look a changing it up a bit, I went down this route just because I could quickly handle the clicks on the cube without figuring out how to detect clicks of the light cubes directly from the PC yet but if that's a better approach I will certainly look into it
It's better if there's a lot more clickable stuff
from a perf/mem point of view? Having one click handler setup on the PC rather than a click handler per light cube? or for other reasons?
Yeah the click handler
instead of object telling pc it got clicked
pc making that call
then the objects can just be dumb actors with a few onreps and thats it
Now i wonder if you can manually call that onclicked event
that might be something worth doing, but it all depends
Is there any way of hosting a multiplayer game as a listen server, when I cannot port forward on my own wifi? Ive heard about doing a NAT punchthrough but couldnt find any resources on it.
Ooo, just discovered the set of functions for detecting what was clicked GetHitResultsUnderCursor[by|for]XXXX this could be handy from the PC within a mouse click handler!
If you're serious about it the best bet is to integrate Steam or EOS
why can't you port forward?
I feel if I'm moving the click handling into the PC then I'll likely remove the click event handler from the light cube completely, kinda makes sense now I'm talking about it with you, maybe later an AI controller pawn might touch a cube to light it up so it makes sense for the ai controller/pawn to just call toggle power or something on the light cube rather than imitate a click π
Well, I really just wanna try out my game at this point with a few friends and dont wanna break much of my networking stuff again. Would integrating that be a lot of work or need like a total rework? Or is there an easier way with just my direct connection setup?
I dont have access to the wifi
Your options are pretty much forward the port or use Steam or EOS or your own code
You could also spin up a dedicated server somewhere but that's about as complicated
your buddy can host if he can port forward
can you explain me why multicast doesn't do print string for all?
I would multicast in the character, not in whatever this is
Would that require a lot of work? Any resources on those two services?
is the actor replicated?
https://github.com/mordentral/AdvancedSessionsPlugin
is probably the easiest
will you explain it to me? π
are you still using "unreliable"?
what I showed in the image is in Actor graph
yes
use reliable then
nope
reliable is not for visual effects
motherfucker you already thumbsupped my explanation lmao
this may shock you but, "unreliable" is in fact unreliable
so you either use reliable RPC or replicated variables
choose
yes but it'll usually go through unless the pipe is clogged, you don't want to prioritize cosmetics over actual gameplay-important stuff
not a big deal if a particle doesn't spawn or is late
yep
I can't really think of a use case for a reliable multicast but I'm sure there might be one
for fast paced combat games it is preferable to replicated variables imo
(if its stateless stuff ofc)
using too many replicated variables also has its issues
@dark edge Does this make more sense? There's now no click event handling on the light cube, all it knows how to do is toggle a replicated boolean which in turn updates the material when changed. The PC now handles clicks and if clicking on a light cube will call a server rpc on the PC which simply calls the toggle power event on the clicked light cube. I understand I could get interfaces involved here too so that PC isn't coupled to light cube. It certainly feels to be a better approach (rather than light cube knowing about clicks)
You might want an interface eventually but yeah that's good
Im only finding resources regarding that for steam. How would it work for mobile?
Thank you so much for your guidance, was banging my head on this for hours last night wondering why the server rpc wouldn't run π₯² you've helped me out massively here!
now you're wanting to throw mobile into the mix?
You really have bit off a big old chunk
There isn't really any Multiplayer specific things with EnhancedInput
Maybe only that you should add Context etc. locally
But that's not IE specific :P
https://forums.unrealengine.com/t/listen-server-clients-animations-are-jittery-laggy/689493
Is there a fix to this problem? Like we can replicate it in any template
Host of Listen Server sees low fps clientsβ animations incredibly laggy/jittery. Iβm using default UEβs Character with Character Movement Component. Clients see everything just fine. Iβve seen a lot of post about this issue but little to none solutions, atleast none that would work. Does anybody have solution for this?
There was once, but I don't know how to do that anymore with recent CMC changes
When playing as listen server, other player animation looked raw. But Clients see each other fine
You would need to override PossessedBy in C++ and skip the ACharacter call
And then make sure the CMC isn't ticking the pose
But that doesn't seem to be that easy cause the CMC part got more complex
Hmmm
At least from the looks of it
Maybe dedicated server is the only solution
Dedicated vs Listen is not a matter of jittery animations Β―_(γ)_/Β―
or dive deep into CMC for the sake of listen server
i will see what where fate bring me
Client see each other fine
no jitter what so ever
has anyone heard of players camera rotation getting reset when another player joins? I cant tell if its something Ive somehow caused or something else
only Server see other animation "raw"
So if everyone play as client, it's a happy world
Well that's mainly cause you put the code into the wrong places
You could do BeginPlay if you lock it to IsLocalPlayerController
Or you put it into SetupInputComponet?
Lots of places. PossessedBy is Server only
So that fails the local player part, yus
Most likely your fault :D

Yeah it's because (Listen)Server "ticks" the Anims via ServerMove calls
I dont even know what Ive done this time, Ill have to look
Ahh ok and the possible fix is
Skip the ACharacter call and
making sure CMC doesn't tick pose?
Yop
thanks, will look into it
ACharacter possessedBy sets that bool that stop the server from ticking
iirc
Well ticking the pose
But I don't know about the tick pose anymore
That was one place before
@thin stratus bOnlyAllowAutonomousTickPose=false Do you mean this tho?
Because that doesn't really fix the problem. The animation will run as twice as fast
it's like depending on tick
Yeah cause you have the CMC Tick the pose :P
OHhhh
ok so I am probably missing that step
gonna SS this so I can remember
Thanks
am i gonna get into trouble for disabling pose tick on CMC?
Probably not
I'm pretty sure we shipped The Ascent with that
I mean
Originally it was one line that called TickPose
That was easy to fix
Now it's called in multiple places
π«
And has its own weird function
I tried disabling that yesterday for something else and that was breaking stuff
Specifically for RootMotion, but still shite
Someone was saying to toggle it depending if root motion is playing or not
but that reddit post have since gone
Never got anything good from Reddit haha
Seems to be only good for placing pixels lately
But yeah, you'll have to play a round with it
πͺ¦
And probably see what the different TickPose calls are for
Makes no sense to remove somethign wtihout understanding it
oh man I cant stand how things are always different for the host of a server man
how do you even generally fix that
hi can anyone guide me how to use multi user edit in ue 5?
Buy your clients good PCs
no like the way events work differently based on how theyre set up
Can only really link the docs
no i mean , yes we can share the data by through doc/github but can we work on same project in ue 5 and also edit works in same project in ue 5
With docs I meant documentation
Documentation of Multi-User Editing
Not that you share the documents
:P
ahh yes
There should be a getting started guide
thank you π
even non replicated events too? how does that even work
Not sure I follow
you know when you start a listen server and the other guy joins, events work different for host and client
As a general thing? No they do not.
I mean there are some rules, but despite that, things work quite similar
then how have I even accidentally caused that
No clue. You probably did something somewhere that is wrong
As stupid as it sounds, no clue how we would know what you did wrong
You will have to start debugging
yeah Ive definitely done plenty wrong but Im kinda trying to ask about the general setup of this kinda thing because I thought that just happens
Camera Rotation, if you didn't do anything else, is probably following ControlRotation
I fixed that, I dont mean that now
its several things, one being only the host can take damage (from enemies and other players) so not sure what needs changing in the bullet projectiles because enemies take damage in the same way and that replicates
You usually deal damage on the Server side and have a Replicated (or even RepNotify) HealthVariable
+- some local prediction if needed, but in it's most naive form that's it
Projectile Overlaps Target, ensure SwitchHasAuthority, call Damage interface, or whatever you use, on the Overlapped Actor
Isn't really rocket science
ah, maybe Im just overthinking it, the actual damage event specific to the player wasnt multicast, must have been confused because of how Ive been working on the enemies recently which are server based
How can i change level to all player
Is there a delegate I can bind to for when an actor becomes net relevant (Either through first join or entering its net relevancy range)?
Begin play
Or actually better yet, can I make a rep notify only replicate/fire when its parent actor becomes net relevant?
oh sweet, i didnt know it gets fired again when it becomes net relevant, that makes sense, thanks!
Repnotify should do that already too, test that
I'm not 100% on it but I think the repnotifies should fire
well i want it to only fire when becoming relevant and not after
ill just use begin play and make the var only replicate
If it's blueprint only, I think the RepNotifies will only fire if the value is different than what the default is, so depending, it may or may not fire when returning to relevancy.
Begin Play is the way to go to know if an actor is relevant.
help
Can someone please point me to the right direction on how to connect 2 clients together using the steam subsystem? I set up the SDK and what not, which the documentation for that is severely out of date.
Supposedly Steam OnlineSubsystem is broken in 5.0+ gotta use advancedSessionsPlugin?
Does anyone know whether it's possible to know what was the previous map the game has taken place on?
save that in gameinstance
Sadge, I thought that there is some other way. All right then π
Advanced Session Plugin works. Have one client create a session and move to the desired level. Have the other search for sessions and when it finds one, join it.
As far as using steam subsystem, I'd recommend you try in #online-subsystems
Just reading through this document https://docs.unrealengine.com/4.26/en-US/InteractiveExperiences/Networking/Blueprints/ trying to make more sense of what sort of logic belongs on game mode and game state. This document had an interesting description for the game mode which I've not come across before (usually game mode is described simply as the rules/flow for the game) but in this doc it mentions a game rule about rocket launchers only and goes on to mention when randomly spawning weapons around the map on the server that this rule should be respected, would that mean in this scenario the game mode is responsible for spawning the weapons OR just that some actor owned by the server will ask the game mode about this rule to determine which weapon to spawn? Most game mode classes I've seen are quite slim, used for nothing more than just assigning default framework classes mostly.
By default the game mode is responsible mostly for handling joining and spawning of players and defining the other gameplay classes being used. That's about it.
Any further rules you want to apply to a game can be handled at the actor level with some variables defined within the game mode if needed assuming the relevant actors are being spawned by the server of course.
Got it thank you!
I am currently trying to get a host to pull in my party into a "Lobby" map. The host creates a session, then OpenLevel() and then calls a ServerTravel(). This works sometimes, but occassionally the client that travels get connection timed out. I notice the logs on the client-side don't really match up with the hosts'.
(Host Opening Lobby)
[2023.08.24-20.36.41:013][ 37]LogEOS: Verbose: CreateSession: Successfully created session 'Default'
[2023.08.24-20.36.41:057][ 37]LogNet: Browse: /Game/Maps/Lobby?listen
[2023.08.24-20.36.41:057][ 37]LogLoad: LoadMap: /Game/Maps/Lobby?listen
(Client Joining (Timedout))
[2023.08.24-20.36.41:377][454]LogEOS: Verbose: JoinSession: Successfully joined session 'Default'
[2023.08.24-20.36.41:378][454]LogNet: Browse: <ip-address>/Game/Maps/Launcher
[2023.08.24-20.37.01:409][757]LogNet: Error: UEngine::BroadcastNetworkFailure: FailureType = ConnectionTimeout, ErrorString = UNetConnection::Tick: Connection TIMED OUT. Closing connection..
I assume things aren't working because the map is not updated on the client side
What about when it comes to processing rules such as win conditions. If we take team deathmatch as an example, that game mode may have a configurable value for team kills required to win, every time a player is killed the server would update the game state to +1 on a team scores, then is it the responsibility of the game state to check team score >= kills required or does the game state ask the game mode to do that check so that it can transition to the next state if a team has won? π€
The game state would probably read a value that is set in the game mode to determine if the max kills has been reached.
That value could also just be stored in the gamestate directly by having the game mode setting in there in the first place when it knows.