#multiplayer
1 messages Β· Page 205 of 1
Yes it is possible but there are hardships.
My game is 100% in blueprints.
your game works multiplayer?
someone told me if you make 3vs3 multiplayer in blueprints
it will not work... cause when someone leave the game the game the server gets destroyed
idk what he mean...
That is correct.
There probably is a better way but I haven't found it.
I have the spaghetti too.
The start/spawning of players each round in my game Strings together like this
Ui selection>player controller>gamemode.
My case sounds different though as I reload everything at the start of every round.
However, soon I will have to tackle the issue of the host leaving a game which means I will need to do what you're doing in a sense.
Unfortunately BPs have no direct solution to this, so as soon as the host (listen server) leaves the game ends.
Have to save the entire state of the game, select a new host, have the new host create a new session, then migrate all player into that new session. To resume
If you're on listen server that's the case.
But you can set a "save" and migrate players individually through their games through BP
Yes
Multiplayer is barely a noob's topic
and i cant fix this with bleurprints?
You can with a deep work around
so it will not work multiplayer in blueprints?
But naturally no, there is no "easy" solution through BP
this is the only problem? for this i need c++ and the rest will work?
rest will work in blueprints?
C++ would be the most efficient way to work around it.
But it is possible through BP I believe
hm so its possible to amke whole game in lbueprints
3vs3 and it will work all?
on steam for example
That's what I'm doing.
My game is 4v4, 2v2, and 1v1v1v1v1v1v1v1
nice
learning project
i send you a freind question
maybe you can accept^^
how long you code your game?
and is it rdy?
It's not. It's mostly a learning project for me. I've been working on it on and off for almost a year but no it isn't ready yet.
It's playable, but not ready.
In a bit perhaps.
My project doesnt use mini maps as the arena's are rather small.
godspeed answering these DMs
can you show me a pciture or video of your game? or gameplay?
Anyone know what he was referring to here? Seems jambax removed whatever was linked https://vorixo.github.io/devtricks/non-destructive-synced-net-clock/
you dont accept friends request? ^^
For getting it to work for client would probably have to check authority on inputaction and have remote call server event
for client its probably not replicating in time. Try using bp debugger and see if its valid for clients
If I have a struct with a member variable marked NotReplicated, does UE do something to it before sending the struct across the network?
it will just be ignored for replication and it will remain at its default/local value on the remote machines
Interesting, thank you!
Hey man just wanted to follow up and say thanks. I just ran a test on game instance, and a test integer I incremented prior to seamless travel persisted after seamless travel. I think I'm on the right track. I'll try keeping the map of players and pawns in there to have a seamless lobby experience.
Silly test I should have done before building out all this non-functioning infrastructure π₯Ή
Awesome to hear! Hope it works well for you, or you find something better lol.
Lol i feel like this is half of learning BP's once you move on from specific tutorials and concepts.
Thank you!
Also, in case anyone ever runs into this issue as I did, player state appears to get re-instanced as well
I incremented a test integer variable prior to travel, then traveled. After travel, it reset to the default value, 10. Unlike the game instance
I suuuure wish the official documentation on this explained this.
Further confirmation. I got the pawns to player mapping to persist across seamless travel and then repossessed the right pawn for the client. Thanks for the help!
Thanks. I tried it now, but even when I lag with Clumsy and slow down the internet, the game doesn't drop like they do, so I can't test the game by trial and error.
Summary of PCs experiencing the problem:
TCP Plugin on, UDP off: 1 drop every 5 seconds on average.
TCP Off, UDP on: Average. 1 drop in 10 seconds.
Both Plugins off, Avg. 1 drop every 10 seconds.
0 drop when the internet is off.
--
I'm making a simple co-op shooter game, don't care about cheating or any such thing.
I'm going to be doing client prediction for shooting (or not even prediction really - client is just going to declare where the line trace is originating from and RPC that to the server).
Is there anything else I need to do / account for to ensure that things are smoothly linked up?
Ideally if you dont care you would also let the client just tell who they shot and on the server you apply the damage and have some way to let other clients know to shoot for your simulated actor so you get the visual stuff, otherwise you are sending a lot more info then needed (assuming you are still in the idc about cheating phase) then let the clients do more locally and just tell the server
yeah definitely my approach so far, but it's the dysncing of the vfx I'm a bit worried about.
I guess its not a problem till it's a problem, but...
it doesn't really matter if it's not synced anyway, but it'd still be nice if the vfx lined up appropriately
You're going to have desync either way, just how networking is, even if unreal wasnt server auth based you still would need to wait for all clients to sync state no matter what condition
Oh you mean the linetrace accuracy
Hi!
I'm not sure if this is the right channel for this question, but I'll do it anyway.
In SpaceWar, a sample project for Steam's SDK, there is a menu option called βFind internet serversβ. What kind of servers does it refer to? Dedicated servers?
You could send the hit bone and local offset to it Should be able to relatively sync up easy with that.
With the line trace direction, and that extra info, you should have everything you need to make hit particles or whatever show relatively correctly.
Is there any delegate to bind that notifies player state is updated or do I need to create my own?
@kindred widget for slow moving projectile, I don't know how to correct the projectile location without snapping it.
Depending on latency, the projectile may hit in one screen but not on the other.
How can I reconcile these differences? Do I just explode the projectile regardless it hit something or not in other machine if on the server the fireball hit something?
Can't wait to dive into these kind of issues ^
probably gonna become the bane of my existence, as it can never really be perfect
π
everything is a trade off
I actually not on the stage to test yet. Haven't got a.i setup or test with other player, but I'm already having nightmare about all of the possibilities
giving to much lee-way to high ping clients ruin the experience for the low ping clients ( to some degree)
not giving enough to the masses in the middle (mediocre ping) could mean they rarely hit the target, ruining their experience
IMO, client should just be relatively correct visually. You play the explosion from something like a cue/multicast. At <50 ms it should be fine in most cases. You can't do much about >100ms.
True, I will just stop worrying about players above 150 ms
150ms should cover most
If they complained, just tell them to get better internet
or spin up a server closer to their region
EG client just locally predicts in between frames, gets updates from server to fix if too far off. Client does NOT play their own explosions. You wait for server to tell client to play the explosion at the correct location, etc.
Atm I'm spawning them and let the projectile move it self.
So each client kinda simulate the projectile independently. No correction what so ever
With network clock I can pass time stamp and correct location but that will result in some sort of rubber band or projectile skipping forward
locally speed up the projectile to catch up to the server
But if I want to spawn hundreds of projectile , I might have to look for another way
I'd focus on the scenarios you have atm, and not theoreticals
otherwise you're kinda stuck in a forever theoretical problem π
Yeah your right
"I solved 100!, now i wanna do 1000"
It shouldn't matter if it's 1 or 100,000,000,000. Code will all work the same since it should be in the projectile itself.
it should, but at some point you probably wanna bulk them transform updates
Performance issues asside, yeah. π
Need to pick my next problem, setup A.I, learn fast array for item system or configure steam socket to get pings for session.
Multiplayer is hard
ignore fast array unless you have thousands π
π
AI is easy. Works identical to singleplayer.
sure, it's neat with per slot delegates, but the performance of an inventory is usually not the most important thing
it's not like its changing every second
I suppose everything is on server side. The brain and command. My issue would probably determining if a player blocked the attack or not.
Since the a.i attack will actually already happend before the player even see it
So before I know fast array, I was just gonna use regular struct
That may be feasible I guess
If you're using a struct based inventory, FastArrays are kinda necessary. Struct based inventories make me queasy though. Super stupid to handle from a UI perspective.
I see
how so
Do you use objects then? And replicate them?
im using struct inventory
replicate what... 3 variables?
rest is local
if i could start over, I'd probably do objects tho
or instanced structs
Make 2000 items. Show them in a widget. Do so without having 3+ms slate prepass and draw time.
Not directly.
Using structs, you have to create a widget for each struct. So you're at 2k widgets at just the userwidget. Add an icon, cooldown, couple textblocks. We're over 10k widgets already probably for a super basic inventory. Even if you collapse half of it. You have thousands of widgets prepassing and drawing.
You avoid this by doing one of two things. Making a specialized widget which is just ugh. Or you use TileView/Listview widgets.
The later requires a UObject to pass to the View widget which you use to wrap the struct.
At which point you're creating UObjects anyhow now. So you may as well just make a UObject inventory in the first place.
I'd probably just do the Ugh part at that point xD
but yeah thats fair
generally weird that they dont optimize their regular containers this way
but i guess they are to generic
And how do you serialise the properties in the object if I don't save the uobject? Store them in an array of structs and recreate them when the game loads again?
Pretty much. But I'd also recommend just saving the entire inventory component and it's subobjects too.
I wrote a bit about it here, and on the Saving Games Smartly linked post
https://brandtborges.wixsite.com/authaer/post/uobject-serialize
The Serialize function from the UObject class is a key feature in the engine that surprisingly few people know about. It isn't talked about much despite how powerful it is for game design. More specifically saving a game smartly.Serialize is a very simple function that performs two basic tasks.It takes properties from a UObject and writes them i...
The general TLDR about it is that it writes what you need from the object to a byte array of PropertyName=PropertyValueAsText.
So if you had like
int32 SomeProp1 = 43;
FString SomeProp2 = "Steve"
You serialize it and you get something like
SomeProp1=43/SomeProp2=Steve
This doesnt use the "SaveGame" property tho, right?
It does or doesn't. That's your choice. You can save the entire thing, or just the SaveGame marked properties.
yeppyepp
IMO, I love it simply because it allows you to save anything generically, and not have mass amounts of upkeep. Literally the worst thing you have to do with this system is that if you rename a property on a class, you have to fix up the loaded data to reflect that in your post load functions.
that makes a whole lot of sense
just makes me wonder why this isnt a default engine function
so much more practical than the BP options
Just be careful, you can easily corrupt blueprints and assets by changing how itβs serialized after itβs already made
You misunderstood the entire conversation or point.
Character movement "Crouch" will change character capsule height, but capsule is still a center of character, so legs will go under floor
Thats the problem
That is weird, because the CMC adjusts the Mesh Offset.
void ACharacter::OnStartCrouch( float HeightAdjust, float ScaledHeightAdjust )
{
RecalculateBaseEyeHeight();
const ACharacter* DefaultChar = GetDefault<ACharacter>(GetClass());
if (Mesh && DefaultChar->Mesh)
{
FVector& MeshRelativeLocation = Mesh->GetRelativeLocation_DirectMutable();
MeshRelativeLocation.Z = DefaultChar->Mesh->GetRelativeLocation().Z + HeightAdjust;
BaseTranslationOffset.Z = MeshRelativeLocation.Z;
}
else
{
BaseTranslationOffset.Z = DefaultChar->BaseTranslationOffset.Z + HeightAdjust;
}
K2_OnStartCrouch(HeightAdjust, ScaledHeightAdjust);
}
yep, thats why I switched to manual
but thats clunky, only solution I found - separated Timeline for capsule height and mesh relative pos
Relatively sure you end up running into corrections with that approach.
thats reliable muticast)0
Doesn't matter. You are modifying the Capsule outside the CMC Sim Scope
also I use smooth sync instead of Movement Replicate, so I need to muticast "crouch" function too?
Crouching in the CMC also does a bit more than just changing the Capsule
Idk, I would never touch SmoothSync. No clue.
Any idea what can break vanila crouch in CMC?
No, I would start by checking if the Z value of the Mesh changes in the Outliner or by printing it.
Good idea, I will try
thats weird, but if server crouch - client see it correct
but if client crouch, server will see it wrong
Hm
Also Z is the same on client and server
are you setting bWantsToCrouch to true on the character movement component on the client? thats the one that replicates
I cant find "WantsToCrouch" in Movement Component
I have my own "wants to crouch" for animation
yeah i'm pretty sure the client just needs to call Crouch() on the player.. no RPC's are needed
Okay, doing it only on client - same thing
but if server host crouch - clients see him okay
Could be a bug with ListenServers. Hm
Hey π
I have a splitscreen game and I create a local player. I have generic usb controllers and have set up two sets of inputs for p1 and p2. How can assign the inputs to a specific player?
I have set up the input logic in the thirdperson character that i use to spawn the players. ^^
You should probably use the OnPossessed Event (if it stays local coop) to grab the EnhancedInputSubsystem of the individual Controller and add the IMC to that.
Am I being stupid here or is this just wrong? I'm looking at FillMembersFromLobbyData in OnlineSessionAsyncLobbySteam.cpp.
This part of the code will always SetLobbyJoinable to false if bAllowJoinInProgress is set to false for the session totally ignoring the actual SessionState of the ongoing session, IE if it's in progress or not. Is this a Steam thing? I'm having an issue with the lobby being closed whenever the first person joins when I'm using Steam due to this.
Thanks for the reply! π
Two questions:
Can i do this in my thirdperson character where i have set up all the input logic?
Do I have to create player controllers? I use the default one right now which spawns a second one (create local player)
First question is because I cant find either the OnPossessed Event nor the EnhancedInputSubsystem
Again thanks for the help ^^
Yes, the Possessed event is part of your Character, you can do that there.
Most of the time, you'd create your own Child Class for PlayerControllers. But it's not relevant to this problem. CreatePlayer creates the Class you selected in the GameMode.
Well I was asking for a delegate for other classes to bind. Creating and calling a custom delegate inside that function was already what I meant by creating my own. But I guess there is no other choice
You'd bind your other classes to the one that already exist
Isn't that a function?
Maybe i was to quick about this
you might be right
pretty sure i bound to it tho
and cant recall making my own delegate for it
There is a delegate for the character in the controller, but I couldn't find a delegate for PlayerState anywhere
Those are both Character functions, OnRep being called on all non server clients (because why would epic ever call an OnRep function inside the server?) and OnPlayerStateChanged being called on the server and owning client only
hi im trying to get a checkpoint system working, it works for player 1 (when player 1 enters checkpoint, and goes into out of bounds he respawns) but doesn't work on player two (when player 2 activates checkpoint, and goes into out of bounds, player 1 is respawned and not player 2). any advice?
One last question, I am setting up right now IMC and IAs, should I delete my previous Inputs set up in the Project Settings?
and how do i get the new input events? is it just the same as before and i search for the name in the context search? ^^
ah ye, found them, but they seem not have the pressed or released functionallity
i guess completed is released?
The stuff in the ProjectSettings is deprecated
You should also see a message about that.
Is player 1 the authority client?
That's my first suspicion based on your description, that you have the logic only working on the local client or server
uhhh yes? if you mean that player one is the host of the server then yes
thank you for your help! appreciate it!
You are probably using GetPlayerXYZ0 @torn basin
wdym
would it be easier if you were to look at my blueprints?
I think I need a custom solution, because I, using smooth sync instead of replicate movement
How to properly change player capsule height? Multicast, or Server -> Client -> Multicast ?
I mean, the answer to that is nothing that is related to SmoothSync.
You change the Capsule via the Crouch functions through the CMC, so it's properly predicted.
I don't use SmoothSync.
I mean that wherever you teleport the Player when they fall out of bounds, you are probably using GetPlayerCharacter 0 or GetPlayerController 0 or stuff like that.
If you fall back to the Server in your code, then it's usually due to that.
Where should i "start/init" my game, after all players connected? I'm doing that currently in InitNewPlayer (i check Number of players), but i can't really do everything i want, because character for last new player doesn't exist yet, only his player controller, how should i wait for a character or where else should i init my game?
@thin stratus one last question again π
Am i going in the right direction? How do I set it up to be the right player controller?
sorry for the noob questions xd
There should be a version of that big Subsystme node that takes an input
You gotta connect that to the NewController input of the PossessedEvent
You don't need the GetPlayerController node.
The Character spawns once for each player and the Possessed Events calls individually inside of each other them for their respective controller.
um i dont think i am using any of them
honestly im not entirely sure
i feel like my code is just jank and im stupid
That part is something you gotta understand.
Cause that will often happen.
Read the error and tell me what you think you gotta do.
a mismatch of the object reference let me see if i can figure it out and i will report back π«‘
What is the type of NewController and what is the type it wants for the Subsystem node.
controller and the enhanced input wants a player controller
Do you know the relation of the two classes/types?
unfortunately no but im googling π
i suppose the controller is input and the player controller is the pawn?
In this case, the naming could give it away
Nope
They are both Controllers. None of them is Input or Pawn.
APlayerController is a Child Class of AController. A more specialized version for Players. (There is also AAIController, which is the AI version of a AController).
Do you know how to get from a Parent Class to any of its more specialized Child Classes?
Also this is all just the Type. The Data that the "NewController" pin points to is the same. The Engine/Code just doesn't know that it's a APlayerController (this could also call for an AAIController after all).
no unfortunately not, so the player controller is the child of the controller parent that comes out as "new controller"?
NewController
To go from Parent to a Child Classes (doesn't have to be a direct child), you use "Casting"
So here you'd cast NewPlayer from AController to APlayerController.
ahh i have casted before to communicate from one bp to another
It doesn'T have much to do with communication.
It's bascially just a Type Test
If whatever you cast to APlayerController is not of that Type (or a Child Class of it), it will fail.
I see, so when you say AController or APlayerController is that a specific class that exist that i can find in the search or is that just a name? Sorry for the dumb question, Appreciate your patience and that you actually teach me π
They are both native Unreal Engine Classes. They count to the "GameFramework" and are very much the core of Gameplay related code.
You can totally find them either in the Source Code, in UE's Documentation and API or even via Google.
so when i cast does it also count in the second player controller that gets dynamically created by the Create Local Player or do i have to take care about this?
or rather how do i cast to that player controller that will get created on start
You don't Cast to a specific Instance
Casting only tests for the type.
Casting NewController to APlayerController only changes the type (if it is an APlayerController).
It doesn't alter the Data/Instance.
And no, you don't need to handle the SecondPlayerController, because that one will also call Event Possessed for its own Character.
got ya now
Don't worry bro. It is.
All of our code is jank and stupid. That's why we're here and not working for Epic! π€£
Mine is even worse, most likely
You're likely running into an issue with replication, since you have 2 players and are not likely using local Co-op
Got any screenshots of the collision logic?
uhh well i kinda just ripped everything
and im figuring it out on my own
it got worse
Logic?
fyi, if you aren't already, please use #source-control
Cedric I am really sorry I havent still figured it out.
I am now casting to the player controller and the inputs work on my first player.
So somethings that I can think of that can be the issue:
- I create the local player in the level blueprint (spawn player controller checked), its the default player controller that is in the project settings
- I use the same thirdperson blueprint to spawn the second player (I dont even know how I could set up another one but thats fine because I can swap out the mesh for the second player)
- I am using two generic usb controllers, I thought maybe the issue could be the setting in the game mode project settings which skipps assigning controllers
Actually funny enough the second IMC also works right now on the first player in the splitscreen π
Ah see what you mean. You made two different IMCs, one for each Player.
Lemme think for a second. I kinda ignored the fact that you would try to do that.
I only had one IMC in mind
But if you need different keys for the two players, then that would make sense.
I use two sets of dance mattes which are cabled to a board which is a generic usb controller so i get digital buttons π I am sorry maybe I should have said that before but im also a bit lost ^^
But aren't the two IMCs identical in setup?
Or do you have different buttons set on the entered IA?
yes except for the buttons which are being triggered
Oh, so they do use different buttons.
yes different IAs for different buttons
Can you show me the two IMCs for a second? With like a few entries expanded?
Okay so
Just fyi, that setup is 90% fine
The 10% that are wrong is that you use two different IA I think.
You can use IA_Left for both, and just apply different Keys (like you already do).
The different entries can have their own Rebind Settings, where you can split between P1 and P2 again if needed.
But I don't think you need to have duplicated IAs.
For the IMCs, we need to figure out how to apply them in Possessed based on which player that is. Let me think for a second
The quickest and dirtiest version would be:
- Remove one of the Add IMC nodes.
- Drag the Mapping Context pin onto the EventGraph and search for "Select".
- You should get a node with 3 pins, 2 for the two options, and the third being a Wildcard.
- Add the GetPlayerController(0) node and use an == Node on the casted Controller result.
- Connect the Bool result of the == Node to the Wildcard of the Select node.
- Assign the 1P IMC to the True Pin of the Select Node and the 2P IMC to the False Pin.
I will try this and report back
Ultimately, that's a bit mΓ€h, but I don't have a better solution atm.
at least not for BPs
Danke!
There isn't really a list of PlayerControllers that is properly mapped to an Index (where 0 is the first player). Even the GetPlayerController(0) node does all sorts of tests to find the proper one.
i think i got the setup right, i also tried to set imc p2 as true to just check, either way only the first player controller 0 has input
That's not gonna work? On possesed called on server
you will be calling that node on the controller in the server
pretty sure you want a client RPC
its a local splitscreen but i dont know im lost π
I'm using a repliacted array of structs where the struct has 2 actor pointers in it. When the array's OnRep function triggers, sometimes the actors inside are null since probably they're just spawned and array's replication received before the spawned actor. Is there a way to ensure or get notified when the actors inside the struct are replicated as well?
oh...
OnRep will fire when the pointers update
here is also the level blueprint of how i create the 2nd player
funny enough here i get also the player character to swap the mesh and it works
would it solve the issue if id create my own controllers? i was afraid of this because i didnt know that class and if i need to do any specific settings
No
This should be fine. Can you add a PrintString node and print the result of the Select node?
To see if it properly prints the two
it did print both imcs
Seemed like it didn't, is it possible that I could prevent that behaviour somehow?
Nothing that I know of. That should work so long as everything is still replicated.
I see. It's nice to know that it should fire OnRep agaion on that condition, thanks. I'll player around a bit more to see what's the problem
Hm, then it should be fine. So at this point, only the first Player has Input and it's controlling the first Character?
yep, i can switch the true and false and only the first player has input from imc one or imc 2. I am watching this video https://youtu.be/SAxCW26nJX0?si=4ZOxNUexpVTSHrau&t=1430 right now. I already tried to add also the input system in the level bp after the creation of the player
Manual implementation of the Enhanced Input System
but doesnt work unfortunately
Yeah I mean that does the same we are doing, just a lot worse xD
im a failure π’ π
You can use showdebug EnhancedInput to check if the IMCs are applied to the right player iirc. And also see if they are being pressed.
If the First Player gets IMC2, does the key they need to press change or so?
Cause otherwise that's a bit strange. Are you adding the IMC anywhere else too by chance?
yes if i swap the imcs in the select the first player uses then the different inputs like the arrow keys which i have set up for debugging the second player. I was reading that it might be timing issue on reddit https://www.reddit.com/r/unrealengine/comments/xtw3xq/second_gamepad_input_not_accepted_by_ue/
Im gonna try the command you sent
There is a boolean in the project settings or editor preferences to route input to the first player gamepad instead of keyboard
Are you using that?
With PAGE UP/DOWN you can select the other one
To check if that one has teh IMC2
just p1 has controlls, but i just turned on the boolean you mentioned, because i had turned it off when i switched over to the enhanced system. funny enough i had control with the keyboard for p1 and the controller that is supposed to control p1 controls p2 xd
What does it show if you change the target with the PAGE keys? It should put the gree nbox on the right player
but its a bit confusing because of player are running on the same tiles aswell and are just visible to their own cameras
Eh, EnhancedInput debug doesn't update properly
sigh
can you try rerunning the command while the other player is selected
Yeah annoying, the debug doesn't update to point toe PC 1
The EnhancedInput part of it
if (HUD->ShouldDisplayDebug(NAME_EnhancedInput))
{
FDisplayDebugManager& DisplayDebugManager = Canvas->DisplayDebugManager;
DisplayDebugManager.SetFont(GEngine->GetSmallFont());
DisplayDebugManager.SetDrawColor(FColor::Yellow);
DisplayDebugManager.DrawString(TEXT("ENHANCED INPUT"));
// TODO: Support paging through subsystems one at a time (via console? key press?)
// Show first player only for now
TObjectIterator<UEnhancedInputLocalPlayerSubsystem> FirstPlayer;
if (FirstPlayer)
{
FirstPlayer->ShowDebugInfo(Canvas);
}
}
......
as if anyone will fix that, Epic..
π
yes
might this issue come from that i am basically having "one" controller?
and i am trying to use different buttons of that controller?
basically one device
Could be?
Not sure tbh
If you can control the individually when turning off the boolean and using the keyboard and the gamepad, then that could be an issues yeah
i could control them individually when i turned on the setting, however it used the wrong imc for player one and they keyboard for the second one π
This does not seem to be getting the right value the client does not get the character that grabbed print string on client says 0 when the other players like player 1 is grabbing it
I have a bug where, if I set a JumpMaxHoldTime while JumpMaxCount is greater than 1, the server randomly performs an additional jump.
I can do a single jump, wait to land, and then jump again. The bug triggers once every 10 jumps, but on the Steam Deck as the client, it triggers once every 2 jumps.
I don't know how to fix this, can anyone help?
These are my logs. The last two lines shouldn't have happened.
LogBlueprintUserMessages: [ABP_Hero_C_0] Server: Idle
LogBlueprintUserMessages: [BP_2DPlayerCharacter_C_0] Client 0: ActivateAbility
LogBlueprintUserMessages: [BP_2DPlayerCharacter_C_0] Client 0: ActivateAbility JumpCurrentCount 0
LogBlueprintUserMessages: [BP_2DPlayerCharacter_C_0] Client 0: ActivateAbility Can Jump
LogBlueprintUserMessages: [BP_2DPlayerCharacter_C_0] Client 0: Jump
LogBlueprintUserMessages: [BP_2DPlayerCharacter_C_0] Client 0: CheckJumpInput JumpCurrentCount 1
LogBlueprintUserMessages: [BP_2DPlayerCharacter_C_1] Server: ActivateAbility
LogBlueprintUserMessages: [BP_2DPlayerCharacter_C_1] Server: ActivateAbility JumpCurrentCount 0
LogBlueprintUserMessages: [BP_2DPlayerCharacter_C_1] Server: ActivateAbility Can Jump
LogBlueprintUserMessages: [BP_2DPlayerCharacter_C_1] Server: Jump
LogBlueprintUserMessages: [BP_2DPlayerCharacter_C_1] Server: CheckJumpInput JumpCurrentCount 1
LogBlueprintUserMessages: [BP_2DPlayerCharacter_C_0] Client 0: InputReleased Jump released
LogBlueprintUserMessages: [BP_2DPlayerCharacter_C_0] Client 0: End Ability
LogBlueprintUserMessages: [BP_2DPlayerCharacter_C_0] Client 0: StopJumping
LogBlueprintUserMessages: [BP_2DPlayerCharacter_C_1] Server: End Ability
LogBlueprintUserMessages: [BP_2DPlayerCharacter_C_1] Server: StopJumping
LogBlueprintUserMessages: [BP_2DPlayerCharacter_C_1] Server: Jump
LogBlueprintUserMessages: [BP_2DPlayerCharacter_C_1] Server: CheckJumpInput JumpCurrentCount 2```
This is the callstack
UnrealEditor-Skeleton2D-Win64-DebugGame.dll!AS2D_BaseCharacter::Jump() Line 213 C++
[Inline Frame] UnrealEditor-Engine.dll!UE::CoreUObject::Private::OnHandleRead(const UObject * Object) Line 118 C++
[Inline Frame] UnrealEditor-Engine.dll!UE::CoreUObject::Private::ResolveObjectHandle(UE::CoreUObject::Private::FObjectHandlePrivate & Handle) Line 230 C++
[Inline Frame] UnrealEditor-Engine.dll!FObjectPtr::Get() Line 110 C++
[Inline Frame] UnrealEditor-Engine.dll!TObjectPtr<ACharacter>::Get() Line 606 C++
[Inline Frame] UnrealEditor-Engine.dll!TObjectPtr<ACharacter>::operator->() Line 625 C++
UnrealEditor-Engine.dll!UCharacterMovementComponent::UpdateFromCompressedFlags(unsigned char Flags) Line 12792 C++
UnrealEditor-Engine.dll!UCharacterMovementComponent::MoveAutonomous(float ClientTimeStamp, float DeltaTime, unsigned char CompressedFlags, const UE::Math::TVector<double> & NewAccel) Line 10226 C++
UnrealEditor-Engine.dll!UCharacterMovementComponent::ServerMove_PerformMovement(const FCharacterNetworkMoveData & MoveData) Line 9641 C++
UnrealEditor-Engine.dll!UCharacterMovementComponent::ServerMove_HandleMoveData(const FCharacterNetworkMoveDataContainer & MoveDataContainer) Line 9541 C++
UnrealEditor-Engine.dll!UCharacterMovementComponent::ServerMovePacked_ServerReceive(const FCharacterServerMovePackedBits & PackedBits) Line 9514 C++
[Inline Frame] UnrealEditor-Engine.dll!ACharacter::ServerMovePacked_Implementation(const FCharacterServerMovePackedBits & PackedBits) Line 1762 C++```
Has anyone tried to mix AI character movement with CMC and root motion? I want slow walking movement to be ruled be the root motion, and have running managed by the CMC
i have this wdget on the left side... but when i go over with the mouse another widget blocks it.
how can i make that one widget dont block the other widget... on mosue event?
@thin stratus hi there, you said before i can use one imc and bind it, any tipps where i do find this binding feature?
I said 2 IMC, one IA per Input for Both (shared)
And the binding part was rebinding
ah
im so tired i even read bad
thx!
i think i figured out the problem @thin stratus
i had implemnted this video https://www.youtube.com/watch?v=QSnUqHF6X0M
Tutorial on how to get split screen local coop working in UE5.1 & UE5.2
A UE5.4 UPDATED example is provided to patreon members https://www.patreon.com/posts/108483497?pr=true
Patreon - https://www.patreon.com/WildOxStudios
Blueprint Example - https://blueprintue.com/blueprint/89dbnxix/
UE5.4 Fixed Skip Player 1 Bug - https://www.youtube.com/watc...
and as you suggested to my question indeed it needs two controllers to be connected
yep, now skipping the gamepad for p1 also allows p2 to use the correct inputs while p1 keeps the keyboard alt settings from input for p1. i think before i had done something wrong or had the wrong buttons maybe. Anyway thank you very very much @thin stratus for all the help and thank you for actually teaching me! Appreciate it a lot!
There shouldn't be any multicasts involved here.
Player Input > Run Trace > Send RPC to Server with Actor they want to interact with > Server Validates if actor can be interacted with (within range, etc) > Server calls Interface > Server performs logic to have client "pick up" the object.
You can't call RPCs from clients on the GameState - those events you have on the GameState shouldn't be marked as Server RPCs.
You should avoid using any kind of "index" for referencing players. Pass along the reference to the player's character, playerstate or playercontroller. On the server with one of these references, you can get the other 2 so anything you may need to use you can get without using the "Get Player Character X" kind of nodes.
So I'm building a server authoritative kinematic vehicle from scratch. In other engines I'd do most of the work in the physics tick so that things are computed mostly the same between client & server.
I know there's the Async Physics Tick, but last time I used that I'd get a crash modifying things directly such as the actor's transform, which I will need for this.
What I'm mostly concerned about simply using Tick is FPS drops throwing off the simulation. Is there a way to do this with the Async Physics Tick?
Curious if anyone here has done any character/vehicle stuff from scratch without using the built in character movement component or rigid bodies
Edit:
Hmm I guess all I really need to do is be able to do sweep tests in the physics thread and I can manage position, rotations and velocities in a thread safe manner
The client have to inform the server of what changes.
The tip here is the only way for client to communicate with server is through server rpc
Read the pinned source few more times
On tick -> send server rpc with transform as the param and let the server set the transform variable (mark the variable as replicated)
On tick for proxy characters, interpolate to the target transform
Multiplayer takes a while to understand but reading the pinned material over and over will show you the way imo.
You should never guess, just understand the theory then attempt to implement. Fail and repeat until you get it.
Have a question. All seems to point to "It wont change" however I want to make double sure. Does the "PlayerID" from Player State Remain persistent in a multiplayer session or will this change over time?
It should remain the same over a session I believe.
Nvm found the original comment
Might not be much help cause I have 0 experience with VR stuff. But...
Couple of things i can think to check off the top of my head
Are the necessary actors/components themselves set to replicate?
Are they also set to replicate movement?
What are you actually doing to set these relative variables in the code above?
You don't need multicast here, simply set the variable on server
Mark it as cond skip owner so you don't get old value in client that is sending. That or when updating filter with is locally controlled
It's actually just the basic of multiplayer. If you are not advance in blueprint or know cpp, multiplayer might be too early for you.
Replication is the least problem to tackle when it comes to multiplayer.
Also 90% of multiplayer tutorial in youtube is either bad or plain wrong.
Tldr not the best place to learn mp. For a start stop using multicast for anything that needs to be in sync
Has anyone have a good explanation for what the packagemap is?
I bet the number would be closer to 99% and I mean that literally
Dug this up from a site I can't even seem to preview correctly. So also pasting the contents.
Package map
The package map is a collection of packages that need to be available on all clients in network games or during demo playback. The package map is commonly referred to as "ServerPackages", although the ServerPackages list doesn't contain all packages that are added to the package map.
Adding to the package map
The package map generally contains packages from two sources. One source is the level package currently being played. That package and all packages it requires (mostly textures, sounds and meshes, but also classes) are automatically added to the package map, because the level would otherwise not be playable. The second source in Unreal Engine 1 and 2 is the ServerPackages list in the [Engine.GameEngine] of the main configuration file. All contained packages and the packages they depend on are added to the package map as well.
There's one exception, packages marked as serverside-only will not be added to the package map, because they are not supposed to reach the client. As a result, packages the client requires must never depend on a serverside-only package.
Packages in the package map are usually downloaded to the client's cache folder, if the client doesn't already have the package. If, however, a package is not marked as allowed to download (which all packages are, unless the package flags are explicitly changed), the client will not be able to connect to the server unless the package is already installed.
Dynamically adding to the package map
Starting with later Unreal Engine 2, packages no longer need to be added explicitly through the ServerPackages list.
In UT2004, packages can be added at map startup via AddToPackageMap(). This function can only be called while the GameInfo's bScriptInitialized property is False, i.e. before the GameInfo's SetInitialState() function runs. That means, mutators and server actors should call it in their [Pre/Post]BeginPlay() events. Mutators automatically do that if their bAddToServerPackages property is set to True. For some reason AddToPackageMap() does not have any effect on demo recording, so to get proper demo files, the packages still need to be added to the ServerPackages.
In Unreal Engine 3 all loaded packages on the server that are not marked as serverside-only are added to the package map. This even happens at runtime, potentially causing mid-game package downloads when the server calls DynamicLoadObject().
Link to weirdly broken site for completeness
https://wiki.beyondunreal.com/Package_map
I think that's mega-old info to be honest, all it's really used for now is to link up network GUID's I'm pretty sure
Yop, more specifically the UPackageMapClient.
The Info above could even be considered wrong? Idk. On the Server, each Client has a UPackageMapClient instance, and that thing basically handles the initial replication of a UObject via NetId and Path, and then later just the lookup for the NetId if the UObject is already known.
That freaking thing is also the reason I lost days on The Ascent trying to figure out why after multiple ServerTravels the damn Enemies stopped spawning on Clients.
Server: "Oh yeah, you should know the NetId of this, so I'm only gonna Serialize and send that."
Client: "The f*ck is this. Can't spawn. Bye!"
Always neat to see how the engine has changed over the years. π
Greetings, weird solutions is here
I created custom crouch for multiplayer, but want to remove those "jumping" on changing capsule height
And yes, we do it on multicast
(nope, I cant use default unreal crouch because we dont use Movement Replicate, and using Smooth Sync instead)
Is InputComponent only processing input events on the client, so does it do anything on the server too?
Input is local
You can test with print string
Does AI controller send inputs or anything like this on the server? Does the server pawn have inputcomponent?
All of A.I is server only
I know those things I'm wondering if Inputcomponent does anything on the server. if it exists then why.
I haven't touch A.I but why do you need input on them?
I'm just trying to figure out how the multiplayer works, if the server pawn has inputcomponent what is the reason for this or it dosen't have inputcomponent on the simulated proxy for the player pawn?
Hi! What are things hard to replicate? I'm on my first pj and I heard a lot of people saying better avoid multiplayer for beginners, perhaps there's stuff who are easier to replicate, I'm not going to do a shooter game, I'd like o have friends/people who can interact with stuff on same map, and every player have his own stats + items collected, is that stuff hard to replicate?
Just think of it in single player when it comes to binding input?
Yeah its just harder to do multiplayer 'cos every action needs to do several things which becomes a process like telling server to do something and telling client to do something and keeping track of this. I would say it takes ten times longer to do due to the confusion. Which is why people say this is hard to do.
Each player need to set their mapping context to w.e pawn they posses
I already hvae this setup. I'm was asking something different, maybe you misunderstood my question is only why does Inputcomponent exist on server simulated proxy.
Thanks I just wanted to confirm this.
Does the camera need to be on the server?
@prisma osprey replication is the easy part when it comes to multiplayer. Turn based game is many times easier or any game that doesn't depend on latency.
You can start trying to replicate a simple variable across all machine. E.g bool or integer then doing a door in multiplayer.
You will hit some limitation when it comes to bp only tho, so just be ware of that.
Pawn Camera isn't doing anything on the server either.
Every one run their own instances of the game. Everyone run their code indepedently
You can have camera on server or on client, you can use it, you can not use it. It's all up to your design
Do you need to know other people camera? No? Then no need to replicate it
Nah do not need other people's camera. I do not think I need pawn camera on the server. Aside from camera traces maybe will need to be on the client then.
Yeah I bet it's very hard and frustrating
This will open up to cheaters however. I will have to think about this. And maybe I should use the other players camera would be fun to do. However that can be done by replicating the position and spawning another camera on the client rather than replicating your own camera.
Once it click it will be fine, the difficult task ain't even that
Well if you figure out the basics its not htat hard just frustrating, Gas is an alterantive which is hard to learn but does those things, if its a simple game turn based is easier, just the inventory will be replicated, if you can code in C++, otherwise blueprint has a few limitations but turn based is easy to do overall. Lagging and things like this are an added layer as @dark parcel pointed out if you're making Streetfighter 7.
The way to describe it is its actually easy there's just a few rules but it's mind boggling to visualise all that, like each thing you do you have to replicate something then inform the relevant things etc. etc. and make sure it works in all scenarios for client / server etc. Gas takes care of some of this but is a seperate framework to learn. If you have many abilities then Gas is the easier way or making your own framework that does these actions, otherwise it's also a repetitive task doing this for every thing your player does and it varies based on the scenario. Gas handles most of those like adding cooldowns and rules etc.
even with "simple" things? Perhaps I can avoid the multiplayer part for now and focusing only on the map/landscape, I can add C++ classes later right?
I don't know what stage you are at but you certainly don't make multiplayer game from single player game. They are different in design
As to what you need to do, you just gotta learn what you have to learn
At moment I'm just working on the landscape, I started a TP BP project instead of C++
so nothing else aside the landscape, can I make it multiplayer later?
You make it multiplayer from the start
Cpp class can be added to blueprint project
That's not an issue
ok thanks!
Multiplayer works in single player but not single player doesn't work in multiplayer.
I did multiplayer in bp but then I threw it away and called it a learning experience.
I would love to use GAS, looks a bit harder for a novice tho
It's really not that difficult if you break it down into a couple of basics.
Abilities: Do something, spawn things, play cues, apply effects.
Gameplay Effects: Affect things, these are damage applications, and regen effects. Buffs and applications essentially.
Cues: Visuals and sounds. These play particles, sounds, etc.
Sorry to hear that, I guess it helped later on anyway!
Looks tempting that way Thanks! I'll give a try π
Not really, it was just a learning experience of how multiplayer works. I wouldn't do it again unless it was something very simple. In the end I would have been better off starting with C++.
Also a lot of effort that isn't reusable like C++ is very reusable as well and blueprints get corrupted really easily like a huge blueprints project is not very reusable.
When I start a project in C++ I get panic all the time when I open the event graph of the character and it's empty π
Although for one person doing small games C++ is a bit overkill because usually 6 months+ learning curve. Blueprints does everything if you want to make single player. Just some limitaitions in multiplayer. If you do gas boilerplate in C++, you can do most of the real code in bp which is normal but that's still hard to find those resources because most / all people who do Gas are c++ coders and tutorials assume C++.
There's Lyra and those sort of frameworks and sample projects but they also need a lot of knowledge or you're limited in how much you can do with them. So you pretty much need to know how to do it anyways. This is why we haven't seen many Lyra games till today. I'm still waiting on one. Maybe there is somewhere out there on Steam. I've seen coming soon games in it though but not very complete.
Thank you, I guess GAS is the way to go for multiplayer, and looks easier
I can recommend some courses if you want to learn C++ then be prepared for 6 months to 1 year journey of learning. Otherwise do single player or something really simple in multiplayer which is turn based but then you still need a server, or if you do listen server turn based that can work but you still need to integrate with steam for that. Gas is kind of obsolete already so I implemented it but I might do my own system for this based on the experimental things if I can make that work. I implemented Gas but didn't make any abilities just in case I need to use this someday.
Gas is kind of obsolete already
π€
Well it would be but the NPP guy left Epic I think so that's a bit dodgy still. I'm seeing how far I get and some others have been attempting this too. But this means NO GAS etc. There's also an example in Mover.
Gas is very much not obsolete though
If I can get this working then it is for me. I still have Gas implemented just in case but I'm trying to see if I can get rid of Character class which is also obsolete.
Still, incorrect
Mover is hardly close to being ready for the masses
It might be fine for you and some others after some more tweaks
But for mass adoption? Still has some ways to go.
Yeah its not ready for the public. I'm just attempting this. It's not officially obsolete unless they get their act together on this issue. Then Gas, CMC, Character all become obsolete or a choice.
It's actually downright broken from what I've seen so far. I'm gonna see how far I get 'cos some people have done fixes here and there etc. I imagine it can work and I saw someone get far too.
I'm really hoping someone at Epic sees this and dedicates resources to fixing NPP. π
Mover can be dropped next week for all we know.
True but they do have someone working on it and the guys doing the Motion Matching sample said they want to use it too. The issue is it relies on the broken NPP which isn't complete so you get rubberbanding and things like this. Its kind of okay for single player. I just noticed some slight jittering but taht could be the animations in the examples.
All of this is clearly saying that both GAS & Character are far from being "obsolete"
Okay whatever.. I'm speaking from the future. I wouldn't look back if this works and it will be obsolete for me. Ofcourse technologically backwards people use obsolete things is normal to do.
That's a take.
Of course! I want one day to start with C++ , I'm always saving for later... still not mastering blueprints yet, I'm afraid to feel stuck with new stuff and not be able to open the engine the next day π
About the GAS part, looks like no matter what framework you'll be using, the result will be great!
Did you made any "zen" game/project already? Sorry I had to ask π
Not realy. I'm building a framework which is what I was doing in BP for 6 months and now I'm doign in C++ and will do the game after this. Basically as my knowlege grows I keep refactoring this same code over and over again, this is the third time but I hope i got it right this time. So my code doesn't work after more than a year and I was here asking about something 'cos I can't check this but I got very far, it does most things and I can make any game on this. I threw away my bp project to use Lyra but started making my own after realising that I would need to know how to make it to be able to make Lyra do those things anyways.
Also not using Gas simplifies my framework but I have those things as optional now I can switch to either for a game project with all the background stuff implemented. I'm hoping to make a pretty huge multiplayer world for a pirates game once this works. I'm not doing more in Gas if this new system works it will be simpler overall. If it doesn't or they abandon then I'll have to do Gas again and build those things out, otherwise it's twice as much effort. I have to pick current gen or next gen so I'm seeing if I can do next gen 'cos who knows when I will be done. The experimental features maybe normal and more stable by then.
My goal is I have various game types that I want to do built in and I just add the characters and data and it does everything already. Then I can do a bigger game or several games on the same platform. At hte moment i'm just doing the Pirates thing which is gonna be team vs team or open world but eventually I can have various modes for games & maps and mini games etc.
First thing I asked on discord somewhere about the engine was about how to make and reuse stuff? Looks like it's impossible π
cool!
No it just requires some knowledge, this is why I'm refactoring for the third time and some of the new features enable this. Right now I'm able to do this already all the data is seperate. I can just create any game on this but I have to build that support in the background if I want to do more variety of game types. I do not intend to sell it so its just to support whatever maps I may need like what if I need the pirate to suddenly be on a zeppelin 'cos he's dreaming of the future fantasy.. then I can just activate that sort of mode or use that in a mini game or a full game. It's also a bit easier to do this with the experimental things rather than the old school things 'cos character movement is depending on Gas and character class and capsule etc. all tied together. All the new things are a bit more modular and a bit easier to extend.
Looks great, congrats!πͺ
Look at this using Mover. This was built in, I just had to set some settings. It's easier to set up things like this but then I was told that I can't use Gas if I want to keep doing this so now I'm on that journey.
https://youtu.be/bIT0J4i9fAA
A simple moving platform with the Mover component.
In this you can see even the platform has many components. This time I'm getting rid of those components and making another architecture. Before this I had everything in the character which got too complicated. This works but it's also overly complicated, the player has 19 components lol and now I'm simplifying it all, then done.
The "jumping" comes from using 2 different Timelines.
You'd need to run both the Mesh Offset and the Capsule HalfHeight changes on the same Timeline.
Also, with your "Multicast" setup, you might want to test if that even properly replicates to Hotjoining people.
(or ones that come into relevancy range)
@cobalt notch Having used NPP and Mover the past few months for a big title, I can tell you: Characters, CMC and especially GAS (which has nothing to do with Mover?!) will not go away.
They did add a new AttributeSystem for Mover, which I didn't have a look at yet, but that's absolutely not relevant to GAS.
We have a Project Level version of both NPP and Mover, which is heavily modified to add lots of missing features, fix lots of bugs and crashes and more.
It will take months before this is even remotely ready, given that we already spend months on improving it and them moving a lot slower.
They are also heavily looking into Chaos driven Movement iirc, so NPP and Mover might really be dropped at some point.
Even for people who are months away from shipping I would not suggest using NPP/Mover.
Oh that's good to know. I might keep the NPP / Mover option experimental then. I'm not sure if I can do that many fixes being a fulltime solo / hobbyist. Are you planning to ship with this Mover or just regretting this or keeping it as a possible future option?
We replaced the previous CMC setup with it and I don't think there are any plans on going back to it.
The only reason we even went that way, iirc, is to have more than one Simulation running alongside the Movement one in FixedTick.
Which CMC doesn't offer.
I was told Gas uses the CMC networking so it's not compatible with Mover / NPP. Maybe if your project supports Gas this would add complications and require fixes etc.
GAS and CMC don't share any networking.
CMC sends an unreliable ServerRPC every frame with Input and final location.
Server receives it, performs the same move and comapres the final location.
Then either acks or rejects the move, sending a correction.
GAS doesn't do that, GAS uses PredictionKeys and single RPCs to communicate.
One usually only sends data when needed, e.g. when activating an Ability.
NPP in IndependentTick mode is basically the same as the CMC, minus the correction sending, as the Server just replicates back to the Client and the Client then checks if it has to reconcile locally.
Which is why GAS, not being able to tie into CMC, also can't tie into NPP (Mover).
Which is why they pushed a MovementModifier commit for Mover.
I tested with one timeline, capsule is falling after height is changed
Current problem - capsule fall
You can probably bridge this somewhere. Which is also what a lot of people do to get CMC and GAS into co-existance.
They send the info to Start and Ability via the CMC. So that it starts on Server and Client in the same CMC frame.
But you'll quickly notice that this is not the problem that breaks things.
The problem is the rolling back.
If CMC gets a correction (or NPP fwiw), it would need to know about the GAS state of each Frame, which doesn't exist.
So when rolling back moves, the moves use up to date data.
Example would be if you are stunned for 3 Seconds and afterwards get a rollback, the rollback will happen without the stun, cause that laready ran out.
And NPP doesn't solve that.
You also need to update the location of the Capsule.
Every "frame" that you shrink the capsule by x, you gotta move it x / 2 upwards.
Capsule === actor character in this case? (because capsule is a root)
Yeah the Character World Z fwiw
If you reduce the halfheight by 10 (so the full size by 20), then the character will float 10 units above the floor.
So you gotta also move it 10 down again.
Which is what the CMC does when crouching while walking.
And at the same time you need to also offset the Mesh 10 upwards.
But how to do it properly insinde timeline? Thats not relative positions, but world - so Im little bit confused
Shouldn't matter
I have strong feeling that I doing it wrong)
You can't take the current location each frame
You gotta save the location as a starting location
Or the Z at least
Before you start the timeline
Otehrwise, second frame, Z will be the updated version
Prep a varivale before timelinne node?
Yeah, a float for the Z
I gotta head out now. Just in case you wonder why I don't answer.
This is wrong.
Itβs used for clients when networking and addressing uobjects through their guids
Neat, tag the person who originally asked. There were replies after this as well they've probably also already read.
also I tried woth World Offset, same result
Even immidiate variant withput timeline didnt work(
If you will be back here, please give an advise(
I feel like character cant change his location because of floor collision or smth
But thanks in advance!
I mean you have to set the same values
Ah it's 56. Couldn't read it on phone
yep, they the same
I use the same Lerm node values
But character didnt changes his Z for some reason
If the character doesn't change location then maybe something else is overriding it
Idk how smooth sync works
Smooth Sync can break it somehow?
YES, THIS IS SMOOTH SYNC
hoh. that weird. I disabled smooth sync and turning on Movement Replicate, so yep - that was the reson
and nobody in the world will know how to deal with smooth sync, Im going to cry in my cave
but anyway thanks for help!
Now I need to create a bad solution to prevent this thing happens
is there anyone want to test with me my multiplayer mobile game ? ( the game uploaded in googleplay store )
Hello I have one problem for some reason My overlap event on my bomb is not executing on Server , only on client i have same overlap on my bullet and it is executing on server and client too, problem is that server call for damage is not working for bomb in multiplayer because its not called there
there is this function but when i hit target it never does damage , on the other event any damage is never executed
This isn't an overlap event.
This is an on hit event.
Also it won't run on on the server unless you send it through a server rpc.
yea mistake hit event
apply damage ? i had it but didnt work I show u
the problem is even i put debug on event hit
its showing execute only on client
not server which is weird
it should go client then server or flipped
its only like this on client
Right click, type custom event, create custom event.
Name it
Compile
Click the event, set replication to server.
Connect your code to that event instead of on hit
Drag from on hit, type the name of your custom event.
Now your code is run on the server.
i know this, tried not working heh π
So the apply damage is on the spawn explosion then and not directly connected to the on hit?
it is on ServerTest now idk whats happening π
Now you've taken the first step to replicating that damage
Are you sure this actor or the one causing the collision is marked as replicated and that you spawned it on the server?
You shouldn't need to send an RPC to the server in order for it to detect a hit or collision
This also is bad form as having an RPC open like that for something like this means a client could potentially call that event at any time when really it's probably just the server that needs to detect it.
ye
yes, but i tried now print this after hit and its printed only on client i dont see server print, when I do same on bullet blueprint i get print on server and client too
What about the "Other Actor" that is causing the collision? Are you certain that it is replicated/spawned by the server?
I am just thinking that maybe bomb is not moving same on client / server, but when I tried play as listen server it was moving.. same so i am lost now π
What is "Bomb" anyway? A mesh?
ye
It may not be depending on how you're moving it.
i think I should start whole blueprint from scratch i am just finding mistake in mess π
Try just placing this object in the level and walking into it, see if you get the collision
okay i can fly in it i have planes there i will try
https://forums.unrealengine.com/t/tmap-replication-exposing-to-unreal-reflection/6653/38
has anyone been down the road of replicating TMap? i've seen workarounds where you wrap 2 arrays in a struct creating something that resembles a tmap but with less efficiency
@chrome bay tried using NetSerialize, which should work based on my limited knowledge, but i'm not having luck with that either
In almost every concievable case, you're better off just using an array of structs
Not 2 arrays, that's dumb IMO
Just make the "key" part of the base struct
Add an == overload, ez
Replicating a TMap is by far the least efficient way to transmit the data.
If the array is small, linear search will be faster anyway. If the array is huge, then use Fast Array and build your own TMap of keys->structs locally if you want to perform non-linear searches.
struct myStruct {
int key;
FString value;
bool operator==(const myStruct& Other) const {
return key == Other.key;
}
};
UPROPERTY(ReplicatedUsing=OnRep_MyReplicatedMap)
TArray<myStruct> myReplicatedArrayMap
TMap<int, FString> myReplicatedMap;
void OnRep_MyReplicatedMap() {
for (myStruct myStructElement: myReplicatedArrayMap) {
myReplicatedMap.Add(myStructElement.key, myStructElement.value);
}
}
is this what you mean?
just made an edit. like that?
Hmm. I don't like the idea of a == not actually fully comparing the parameters π
Also you should empty the map and reserve it with hte array size.
when you say fast array, should i be looking into FFastArraySerializer
So you don't have lingering values.
Yes and the corresponding fastarrayitem
I have a character and a vehicle. When the character enters the vehicle, they possess it. However, if the player exits the game while in the vehicle, the vehicle gets destroyed, leaving the character floating in the air. I want only the character to be destroyed while the vehicle remains. I tried unposses car and destroy character in player controller end play event but did not work
The Vehicle will be destroyed anyways when the game ends so maybe just do destroyactor if there's a character in the OnDestroy of the Vehicle.
Yes, this solution successfully destroys the character, but is it possible to save the vehicle from being destroyed?
I do not understand. If the game ends so there isn't any World, so how can the vehicle exist? You could save it in a savefile if you need to save it's position etc.?
this is dedicated server
Still doesn't make sense? Where will the vehicle exist without the game world on the Server?! Why are you ending the game if you want to keep playing?
the player isnt the only one in the game
You can think of it like in PUBGβwhen you die or exit the game, the vehicle remains in the world for other players to use
The Game Mode has an event when a player leaves
void AGameModeBase::Logout(AController* Exiting)
Oh you need to prevent the vehicle from being destroyed. See what's triggering this.
You need to unpossess before this vehicle destruction happens and prevent it. Maybe do a breakpoint in vehicle->ondestroy and see what's triggering this and if you can hijack it to unpossess the character before this. Maybe someone else has a better answer.
Or you can just probably do this unpossession check in the GameModeBase? Check if the vehicle has a character for this player and unpossess the vehicle etc.
I'll try thank you guys
IS there a way to use Old Black Ops 2 server that someone is host
Yes, a primary asset id is just the name and type combined
The event is being triggered here, but the event in the Player Controller is never called
Not sure about BP break pointing sorry I use c++ mostly but I would try step into the call if you can even do taht
i did it just skip player controller break point
BP breakpoints can be fickle... Make sure you have an active object selected I guess
I'm not sure if they only trigger for the selected objects or if having no object selected has the first breakpoint trigger
The event only triggers if I set it to 'Run on Server' in the Player Controller, but then I get a 'can't read' error for the interface in the event. This is really confusing
Once you have logged out, you might not have a pawn
Questions: Are any of you all working on multiplayer projects that use a dedicated server?
Is it possible to, not build but, design a game using only blueprints for server logic?
If you are taking this approach what are you or your team doing to separate logic that only the server needs to know versus the client?
What does your development pipeline look like?
guys why is this event not calling on server? i have problem with executing event in MP because this one is calling just client
Input only happens on owning machine
yea i have weird situation when i call one event from begin play its behaving correctly but when I use RPC call to it from enhanced input it doesnt work good
enhanced input -> server call --> multicast
Well, show that part of the code. Because your initial message sounds like you're wondering why input isn't running on the server.
well its kinda mess but when I call this in red circle from begin play everything is playing perfectly bomb is thrown and it hit target then it make damage
but when I connect it to enhanced input bomb will fall explode but damage event is not executed on server
and i dont do any damage
(that line from right side is from event begin play)
input actions are only ever called from client, but what owns this actor?
though being unable to call an RPC due to incorrect ownership is usually printed to the output log
I just spawn that bomb attached to plane and then press mouse i am trying to throw it it is replicated etc but unfortunately its not giving any damage, via enhanced input or mouse button left function, when i tested it via begin play its working, when i debugged i saw it is calling on server and client too via begin play but on input and mouse click only on client
when I made RPC call for it from mouse input same result no damage
idk what to do
hiya! i am running into an issue using lyra and 5.3. on my packaged builds, it seems like the client is not spawning / connecting after server travel. can only repro in packaged builds
client log:
LogNet: Verbose: NotifyLoadedWorld Begin
LogNet: VeryVerbose: GetFunctionCallspace RemoteRole Remote ServerNotifyLoadedWorld
LogNetTraffic: Sent RPC: LyraPlayerController /ShooterMaps/Maps/Map_MockUps/UEDPIE_0_Map_A_Early_Access.Map_A_Early_Access:PersistentLevel.LyraPlayerController_0::ServerNotifyLoadedWorld [62.4 bytes]
LogNetTraffic: VeryVerbose: Sending: FOutBunch: Channel[3] ChSequence: 372 NumBits: 499 PacketId: 0 bOpen: 0 bClose: 0 bIsReplicationPaused: 0 bReliable: 1 bPartial: 0//0//0 bHasPackageMapExports: 0
LogNetTraffic: Verbose: FNetPacketNotify::WriteHeader - Seq 4505, AckedSeq 2567 bReFresh 0 HistorySizeInWords 1
LogNetTraffic: Verbose: UNetConnection::SendRawBunch. ChIndex: 3. Bits: 499. PacketId: 20889
LogNet: Verbose: NotifyLoadedWorld End
LogWorld: ----SeamlessTravel finished in 10.58 seconds ------
LogNet: UNetDriver::TickDispatch: Very long time between ticks. DeltaTime: 0.02, Realtime: 6.37. IpNetDriver_2
LogNet: UNetDriver::TickDispatch: Very long time between ticks. DeltaTime: 10.19, Realtime: 3.84. IpNetDriver_2
LogLoadingScreen: Loading screen showing: 1. Reason: GameState hasn't yet replicated (it's null)
LogHandshake: Beginning restart handshake process.
LogHandshake: Ignoring restart handshake request, while already restarted.
LogHandshake: Ignoring restart handshake request, while already restarted.
LogHandshake: Ignoring restart handshake request, while already restarted.
LogHandshake: Ignoring restart handshake request, while already restarted.
LogHandshake: Ignoring restart handshake request, while already restarted.
LogLoadingScreen: Loading screen showing: 1. Reason: GameState hasn't yet replicated (it's null)```
so who owns BP_Harpia?
you set an owner when you spawn and you can change it after the fact with SetOwner
player controller
Add a breakpoint, is the BombSpawn RPC call on the client called? Is BombSpawnMP called on the server?
is BP_ProximityFuseHarpia replicated?
are any warnings or errors printed to the output log?
Hello.
I am trying to block all inbound packets to my game using clumsy.
Is there a way to find my game application's listening port ?
when setting a variable on the server does that variable need to be set to replicated in order for that owning client to be able to know? for example, i set a max mana variable upon level up or something and this function is on server and i set the variable accordingly, would i need to have that variable set to replicated in order for the client to be able to use it when checking client side if they have enough mana to cast a certain spell/attack?
yes
use the COND_OwnerOnly replication condition if you want to only send it to the owning player
I want the vehicle to remain on the server when I log out while inside it. For this, I unpossessed the vehicle in the GameMode Logout event, but this event is triggered after the vehicle is destroyed, so this solution is not working. Is there any other solution suggestion?
how can i check if player is listen server or local player?
i just want to spawn actor only once per player, one for listen server and it's pawn and one for client's player. not for simulated proxies.
is locally controlled works for dedicated server but not for listen π¦
IsLocallyControlled works fine on Dedicated and Listenservers. It will always be false on a Dedicated server, it can never be true for any reason. It will be true on a Listenserver for the listenserver's stuff.
Is the thing you're wanting to spawn replciated or local only?
@kindred widgetlocal only, but for listen server IsLocallyControlled returns false. i spawn this actor in begin play and i've heard it might be the reason
Are you spawning it in the Pawn?
yes
That will be your reason then. Beginplay can run before the pawn has been possessed.
oh, ok then. where should i do it then?
@kindred widgeteverything works now, thanks
OnPossess^
why aren't my players spawning in different locations? this is the logic I used in my player controller
it's from the VRE plugin if anyone is familiar
woah. looks pretty barebones right now though
Why no asset bundles so you don't have to load the meshes?
And it's not really a dedicated server question
If you want to keep an asset loaded, you need a hard ref to it
Hi! Iβve been reading Kaos messages about the Fake Projectile, thanks a lot for the insights! Iβm a bit confused right now. Iβve implemented the "Catchup" tick system like in Unreal Tournament, but Iβm not quite sure how this part should work.
FRepMovement FakeReplicatedMovement = LinkedFakeProjectile->GetReplicatedMovement();
FakeReplicatedMovement.Location = GetActorLocation();
FakeReplicatedMovement.Rotation = GetActorRotation();
LinkedFakeProjectile->SetReplicatedMovement(FakeReplicatedMovement);
I expect that SetReplicatedMovement wonβt do anything since the FakeProjectile exists only on the client. It seems like thatβs whatβs happeningβthese lines donβt affect the Fake Projectile. Did I miss something?
P.S. Was missing a manual "PostNetReceiveLocationAndRotation" with removed "CatchupTick", thanks anyways!
Fair to say that Set Visibility is a local change and doesn't automatically get replicated from server to client? Or is there more nuance here?
Yes it's local. Replicated components only replicate replicated properties
I'm assumign the same is true for Set Owner No See, also purely local?
If I have a replicated struct and that struct has a struct property, does that inner struct replicate per-property as well?
Yes, the easiest way is to see if the property is Replicated in the header
Typically you don't replicate mesh components at all
Ah great, this makes no mention of being replicated, so I can safely assume it's not?
Yes, component replication requires you to mark properties as explicitly replicated, the same as actors
Perfect, thank you.
Actually on that note, it seems like bVisible is replicated, but in the code I'm looking at, the author still does manual visibility setting on the client.
I checked and it looks like the mesh component is indeed not set to "Component Replicates". Fair to say that because the component doesn't replicate, even if bVisible is set to replicate, it will not, which will require people manually update visibility?
This is correct. The property needs to be replicated, and on a replicated owner(actor or component), and if the owner is a non Actor UObject, then the owning actor of the thing that contains the replicated property must also be replicated.
So in this specific case. The Actor the Component is on needs to be replicated. The Component itself needs to be replicated, and then the property needs to be replicated. If any of that is untrue, it will not replicate to clients.
Something I wish I had better understanding of in the multiplayer context is the relationship between Set Visibility and Set Owner No See. It's very heavily used in the project I'm looking at, where the player can switch between FPP and TPP. E.g. these pieces of functionality.
I'm a little puzzled about why the author bothered with using Set Owner No See given that none of these meshes are replicated as far as I can tell, so they could have gotten away with just using Set Visibility everywhere, unless I'm misreading this.
Set Owner No See is not about replication, but about view targets
if you are possessing a pawn probably have it as the view target
which tells the scene renderer everything attached to that actor should be considered for owner see/no see
It's a bit of a bad name for the function, it should be NotVisibleWhenViewTarget or something
Hello, I have problem about movements with Listen Server testing -just on client sides-. clients always see their movements and interacted objects movements laggy but test doesnt shown much ping(just around 16-20ms). 2.image is from project settings and 3.image is from players pawn. I just changed this settings with AI suggestions. -btw on one computer testing doesnt have any visible movement issues.-
Can anyone help me about it π€
Awesome. Was curious if the condition would help, but would that then be still replicated via events /functions to other clients ? Not that they need to read the variables but having them still get whatever event was fired via maybe a repnotify fx afterwards etc? Not sure if that makes sense.
Ex: owning client has to check locally , a variable set by server to fire attack, that variable set to owner only, so it would fire the server event and thus the remaining logic
where would be a good place to route authoritative api calls (get / set player data) between a game instance and PlayFab? Seems like gamestate would be a good candidate for this?
I would imagine so. Haven't tested it though.
That was my thought, but yeah.
Hey all! Which would be the best way to handle a UI widget in a multiplayer scenario? π€ Iβm currently creating it in the player controller, but not sure why the client would get a null result due to an interface message Iβm trying to call. Not sure about which kind of reference I should input there. Adding a screenshot in a second :D
A HUD class is generally a good place to manager interfaces.
Don't forget to set the hud class on your game mode.
Whether it's related to your problem or not is another question π
oh yes, so you suggest me to remove it from player controller and pass it to hud? as far as I understood, hud would generally handle non-interactable widgets, right?
nw for the ""off topic"" haha!
i'll have to deal with this anyway now or then so I wanted to ask more: assuming that would be an interactable widget, how would I handle this event in the widget blueprint? I'm trying to access my player's reference to handle stamina and things like that in the widget
this is what I'm trying to do in the widget, but I can't understand which kind of reference I should input in the GetBPPlayerMaster interface message :(
should I even try to access my player character that way?
Hello everyone,
Iβm seeking some clarity on handling player character selection in a multiplayer lobby setup. I understand the role of various WorldSettings, their replication, and their existence on the Server/Client.
In my current project, Iβve created a simple multiplayer lobby using a custom Lobby_GM. Once all players are ready, I load the chosen level, which uses a different Gameplay_GM. My main question is: where is the best place to store information about the chosen player characters?
From my research, it seems different documentation and examples take various approaches. Some store this information in the GameInstance on the server and have the GameMode use that data to spawn the correct players. Others use a save object, while some avoid using a different GameMode entirely.
What would be the most correct or recommended approach here?
Bonus question: Assuming the process starts from a client's UI (e.g., selecting a character), would it be better to handle the RPC to the server in the PlayerState or PlayerController?
Thanks in advance! π
If you are using a normal "Pawn" instead of the "Character" class, then you aren't using the Character Movement Component (CMC), which mean you most likely have 0 proper Prediction for the Player Movement. I don't know if Physics Prediction covers any of that, but your game doesn't look like it needs actual physics.
All of that can be faked with a bit of Vector Math.
If you aren't using the CMC, then you'll need to code Client Prediction etc. yourself.
RPCs in PlayerState (PS) or PlayerController (PC) make no difference. If your Data is stored in the PC then use the PC, otherwise the PS. If it's stored in both, I would use the PC, cause that's the Owner of the PS. But even if it's stored in the PS, you can still do it in the PC, it really doesn't matter.
About the "how to handle character selection", if you are already in a Lobby, with connected Players, then it's relatively straight forward.
You do need to ensure that you use "Seamless Travel" on your GameModes that the Server Travels from and to.
After that, you can use either the PlayerState's "OnCopyProperties" to move the Data from Old to New PlayerState, or the GameMode's "OnSwapPlayerControllers", to move the Data from the Old to the New PlayerController.
I would further suggest ensuring that both your GameMode_Lobby and GameMode_Gameplay share a Parent GameMode, e.g. GameMode_Game.
Same goes for your PlayerState and PlayerController. That way you can have the variables in the Parent class, and don't need to implement sending/receiving the data in Lobby and Gameplay versions.
I would also suggest you use the PlayerController option to send the data (GameMode's OnSwapPlayerController), because then you can override some of the GameMode's functions that allow you to return a Pawn Class based on a Controller Input, and the Data is usually already available then, which makes the whole thing very smooth.
Extremily insightful thank you very much. I was not aware of the OnCopyProperties of the PS. That clears things up quite a bit!
Having a shared GameMode Parent also allows you to easily send additional Settings via the URL with ?Key=Value pairs, which you can then grab from the OptionsString in the same GameMode on BeginPlay for example (better would be InitGame, but that's a C++ thing).
I'm fine with C++, but it's great to know!
Hmmm, using default character class so everything inside but my default setying looks good? π€ I dont understand them so just approximately changed them. Btw its a basic movement so I think it shouldnt need any right?
Does anyone know how to fetch WAN IP with blueprints?
Almost 100% sure that you can't.
I wouldn't know if any node that could do that.
Idk, that's kinda all up to you. You can also make your own Character Child BP fwiw.
How about obtaining incoming connections public IP?
Okey then I will try a new pawn maybe it will be better thanx for help
Hm, also not. There is some info inside the GameMode itself in C++ when someone connects, but I don't think the IP is available. Subsystems like Steam also do a good deed to no reveal the IPs.
Why does voice chat need to be networked separately instead of using the same channels as the rest of the game?
Q: If a RepNotify variable changes while the player is offline. Shouldn't that RepNotify function fire when the player logs in?
It doesn't fwiw.
UE has Voice Chat implementation. It has a strange "Session" requirement, that can be tricked by adding a fake NamedSession to the Array, but despite that it should work.
Then why to online subsystems need to support VC?
It would, but at that point you probably just received the latest version of the variable with the initial bunch and it might call before BeginPlay, which can have side effects. It's a good idea to call your Logic on BeginPlay too.
SubsystemNULL works just fine.
Even Direct IP Connections should work, if you fake add the Session
Not sure why the person who coded that added that requirement.
Maybe legal stuff regarding consoles
I'm still really confused how the session system works. Do you have any resources on that?
I assumed a "session" represented your connection to a multiplayer server
Is it not?
No, that's more or less just a connection
A Session is something that holds information about the Server and the Game.
It holds information about how to connect to the Server, how many and which Players are on the Server, what Map is being played, and all kinds of other stuff you wish to add to the Session Settings.
Sessions are, when created, added to a MasterServer's Database. Most Subsystems handle that for you. E.g. Steam and EOS both have a MasterServer concept. Finding Sessions is then basically done by asking the MasterServer for a Session. Joining it means the MasterServer will add info about the Player to the Session. That's usally communicate via unique Ids (e.g. your SteamID).
You can totally connect to a Server without a Session. E.g. directly via IP.
You can also join Sessions without connecting to a Server.
The JoinServer node in Blueprints actually does both after one another, joining the Session, extracting the conenction URL from it and then connecting.
Hope that clears it a bit up.
thx
Hey
I have not seen solution for Join Session problem yet.
I use 5.4 and Steam
There is a Menu and Game map
Advanced Find Session can find the host server finally, but when i try to join I cannot travel to the map. It is reload the Menu map.
- I added DefaultEngine.ini the lines with my own steamappID ,
- I set MenuGameMode and MainGameMode "seamless travel" = true
- There is no any other error.
I cant solve it for days.
Any idea what can cause this Client Join Session problem?
fwiw, MainMenu GameMode having SeamlessTravel shouldn#t do anything.
Caues that's only for ServerTravels and connecting is always a HardTravel anyway.
Does the joining of the session fail or the connecting part? You'd need to check your logs for this stuff.
Alright I'l check the logs.
By the way, On Joined Success is called but after few seconds it looks like start load the map where is the host, but reload the Menu.
- No firewall problem.
- Everything works fine on my local PC ( without Steam) , only with other PC cannot join - if it helps
Is calling a Server RPC from the server somewhat of an antipattern? Instead, should I be pretty dogmatic about separating branches by HasAuthority and avoiding letting a server RPC itself?
You should avoid making anything an RPC that doesn't need to be an RPC. You can still have the server call the RPCs if it needs to, but the intention here is that you're marking something as being allowed to be called from a client to then have the server execute what happens next.
I'm assuming this is to avoid having the server package the request into something it sends over IP only to receive that request back immediately on the same box?
It's mostly to prevent clients from being able to make requests they shouldn't be allowed to make. Marking something as an RPC is opening the door to the server allowing clients to request the execution. Someone with a little knowhow can force their client to call those RPCs on the server even if you don't have anything within your own code that would call it normally.
The thing that bit me hard in the past when I was trying to get Steam connections work was:
- making sure the server opens the level they want to host the game at with a
listenoption, without which the process will not be open to receiving client connections. Super easy to miss. - making sure I run the game outside of the editor, in a quick build or a fully packaged build, otherwise Steam doesn't seem to work (Stephen Ulibarri's tutorial seems to be the only one to highlight this, Youtube tutorials skip over this entirely IME)
I tried my best today trying to understand something, but Iβm still very confused about how everything works: can you suggest me the most basic way to test out things? Iβm both confused because of the complexity of the topic and because when playing in the editor, one instance is both a server and a client and Iβm not really sure how I should handle that. Thanks!
If you're talking about playing as listen server, then it is not both a server and a client, that instance is the server, the other is a client to that server.
If you put a print string on an input and on the player controller, then you should see "Server: Hello" when you press the input on the server's window, and "Client: Hello" when you press the input on the client's window.
It gets confusing because the player controller itself can exist on the server and the client, but they are technically the "same" object. So if you had that same input call a server RPC and made another print string on the RPC, then you would see "Server: Hello" "Server: Hello" when pressing the input on the server, and "Client: Hello" "Server: Hello" when pressing the input on the client. This doesn't mean you're executing on the server's player controller, just the server's copy of the client's player controller.
Thanks for the answer π
Yes, i have added "listen" and i know steam works only standalone if i use editor.
If I start 2 standalone they can join and open level without problem( if no steam)
The problem when two different PC try to join each other- Join is succesful, but when servertravel would happen just nothing happens. π¦
EDIT:
The log says it is TimedoutConnection problem.
I do not know Can I use Steam SDK for achivements but not using any of network part.
Hey! What's the preferred way to move a character from its position to the targeted location in multiplayer like in a moba (LoL, DotA). The simple MoveToLocation() is not networked afaik. I currently do have the target location, I just need a way to move the character using the Navigation system
When should I be seamless server travel vs regular server travel?
Generally speaking you always want Seamless Travel enabled.
Thanks for explaining it to me ππΌ spent the last hour breakpointing wherever to understand flow and yes, I now understand what you mean, I hopeπ
In a 2 player ListenServer scenario, there would be 4 controllers: 2 are local players and 2 are server copy of it. Or is it that there will be 3, 1 being the Server (Host?) one, and 2 divided into client and server copy of that client?
Are you talking about AI? Iβm starting out on multiplayer and totally didnβt account on that lolll
Luckily AI is just basic attack for now haha
In terms of player controllers, you'll have 1 copy on each client, and all of them on the server.
So with a listen server, you'd expect there to be in total 2 instances of player controllers, but 3 that actually exist, one for each player on the server, and one that exists on the client.
Okayyyyy
Thatβs because in the listen server scenario, one client becomes host and thus server, right?
A "client" doesn't become the host. They are just the host and are the server.
Alright. My brain was thinking βwe all start as clients and then one becomes server when creating a sessionβ
There's never a client until a second instance of UE is involved.
Ohhhhhhh
Before joining a session or starting a listen server up, the game is considered standalone.
If you start as "Listen Server" then you're forcing one of the windows to immediately start as the server, and having the other window join it.
is it simulating creating a session? I'm super beginner
like as both players were clicking ready? or am I comletely on the wrong route?
A "session" is something kind of "outside" of regular networking. It's soemthing you join that allows you to join the actual server.
hmhm, I guess I'll understand more as I go!
Like a meeting place to start a game.
ok so when starting the session as listen server I'm "skipping" that part?
How are you starting a session? Words are important here. You can start a listen server without a session.
Unless you don't mean a "session".
I don't know what i mean with session tbh, so thinking about waiting on that topic haha
If you just mean "I'm just starting a listen server" (because "session" means something else) then, yes, just starting a listen server involves no sessions.
If you want to deal with sessions, you need a session plugin like steam or eos.
Sessions are a separate concept in Unreal - they act as a means of broadcasting that a game exists through online subsystems that allows players to find and join the game without having to use IP addresses and the like directly.
hmhm, and is a session something that usually precedes what's happening when I click play on ue?
No.
lol
If you mean play in editor, yes?
A session isn't automatically posted somewhere.
yes i mean play in editor
Do sessions even work in the editor? Last time I checked they didn't. This was like 8 years ago...
When you hit play, unreal is creating a server, and then has the client window connect to it. No session involved.
They do.
a session doesn't exist if I don't create one, right?
Correct
but when I create one, I could do something before spawning the players in the level as I'm doing rn, true?
The PIE stuff kinda skips the session step because any clients that do join automatically just join your server.
that's what I mean and let's hope Datura agrees haha
or will be a good point to discuss if not
A session doesn't really have anything to do with the game world itself as the sesssion is normally created external to Unreal, therefore, you can do whatever you want after creating a session - you have to actually enforce that who you want as the host to actually move to the level and set themselves up as a listen server before anyone would be able to successfully join that session.
I guess you can test the session setup without clients. I'm not sure how you'd test actually joining through sessions via PIE.
You can start as standalone and have one instance start the session and have the other find and automatically join - at least with the null subsystem.
i'll dive deeper into it! I can't understand that completetly because I'm missing other basic concepts
Have you ever played CoD?
yes
Erm, never mind actually. That would just be confusing.
all good! i appeciate it
I have another question related to spawning the client character. WHat could be making the server to properly get a ref to the pawn here but then the client can't? Second pic is player controller
Where exactly is it failing?
in gamemode, IsValid node
wait let me see if it works in player controller in facts hehe
but it should
fails on the return value
ah no lel
should be fine on that part
it won't spawn the right class tho
so Server spawns PlayerMaster but client spawns no class, I was trying to print the display name in the PlayerState begin play
The player state will replicate before the player sends the spawn rpc.
oh I see
There's a client acknowledge possession or something event, you could try that.
let me see!
Not exposed to blueprint afaik
could it be this? it's the closest i could get to yours lol
yes sure, was trying to understand how playerstate worked
and like, goot to discover that it runs before the rpc
is it because of order of initialisazion?
orders are unreliable, don't rely on it
I'm not aware of the order things get created tbh, beginner again :D
I'm assuming
GameInstance>GameMode>GameState&PlayerState>PlayerController>Other things ?
and why do you say that those are unreliable? I'm thinking there will always be an order at which initialisation processes happen
not strickly speaking about initialization but you should never rely on orders when it comes to multiplayer
say you send multiple RPCs at the same time
there is no telling which one will arrive first
ah that's for sure, I agree with you
some people also do stuff in begin play on their controller, but during that time, the server may not have create a pawn and let the client possess it yet, hence null on controlled pawn when accessing from client.
(not talking about your case, just example)
got you :D
next question is, when does a character gets assigned to the playerstate?
Automatically on spawn?
hence why trying to print on begin play for both characters would bring to a null result on the client side
The player state may not be replicated yet
everyone running their own instance of the game, running code independently
use On_Rep to check when it's value changed
I'm newbie so may get this wrong but I feel like begin play is not a great place for mp stuff in many context
there's should be events or on_rep you can use before falling back to begin play
I'm noticing a pre-made event dispatcher in the playerstate called OnPawnSet
sounds like smth I want to use maybe for this super basic print string thing
just to see if things run properly
you're talking about the replicated variable option?
hm, what should I replicate?
but before that I need to understand why a playerstate is not getting the client side pawn
What approach would you use to make an HL2-type level transition where actors within a transition volume get moved to the next level, relative to a waypoint
I'm using seamless travel.
If all you want to do is transition the background you could just do that; not always but that is a possibility.
Like if it was a level like Portal and you want them to travel to the next 'level'; you wouldn't need to actually travel to another "Level"
You can just change the background.
wdym
Let's say you have a room with a dragon; players defeat them and they move to level 2.
Which is a dark room with a demon in there.
They don't actually need to travel to another -Level-.
You can just put a loading screen, spawn the next room, get rid of the old one; replace the enemies; heal players if applicable or the such.
And that's it! You can have that be synced by pre-loading the assets for the next level as well; no need for a level transition in this very particular scenario.
For technical reasons that's not viable
which technical reasons?
Well first of all, I'm already using a procedural dungeon generator
This likely won't stack well on top of that
How do you want your players to move to a new level? and what would a new level be for your game?
Kind of like lethal company
There's a "ship" that moves between levels, but the players should remain in the same place on the ship
Also, the location of the transition in the levels isn't guarenteed to line up
Like if it was a level like Portal and you want them to travel to the next 'level'; you wouldn't need to actually travel to another "Level"
(That's not how Portal does it FYI)
What's the problem? Cuz it seems you already got it figured out.
I'm trying to figure out the implementation
How to implement seamless travel?
That, but also what the best approach to making sure everything stays in the same place within the transition volume, relative to a waypoint
Everything should stay in the same place; why wouldn't it? Also what waypoint?
Because the transition volume may not be in the same place in every level
Kind of like what info_landmark does in Source
I keep getting errors on the binding of the client player for his widget references...what's the deal here? π€
actually I might just not be creating that in facts
no untrue, it's getting created but like idk how to properly manage that
You need to share more info
Hello, im looking for advice from someone who already implemented and tested the thing i ask about in a real game. So basically im spawning an actor on the server (Melee Class, the Hit logic is inside the actor and also its properties), the Anim handling etc. is done in the character. I predicted the swing and hit logic, but i can't find a reliable way to client predict the equip, since i can only access the actor as soon as its spawned on the server, which means with latency it will always take a while. Whats the approach to client predict the equip animation when the client first knows about the actor when its spawned on the server?
Do you spawn a new melee actor for every attack?
No, i spawn the actor on hotbar equip, and destroy it on hotbar dequip
so as long as its equipped its active and spawned in
I don't think you need a replicated actor for something as simple as "a weapon is in my hand"
you only need to send over which mesh is in the hand, and maybe some ID/class pointer to the bp that describes how it looks and animates
so for starters I think you are wasting a lot of bandwidth for this even besides predicting etc
but that said: you might have some extremelely fancy setup where there is something unique about each weapon that isn't simple enough to describe that way... I still think you could get away with a BP class pointer though etc
One sec, i can show you my setup
as for predicting stuff it depends on the kind of game you are making
why do sim proxies need to know more than just the last two data assets? I think your setup there looks sensible
regardless of setup though: do you actually need to server auth the attack?
Yes thats predicted already
then why the hell don't you predict equipping the weapon?
going to need a bigger monitor here lol
then don't spawn it on the server and wait... just have the character have one mesh at a time represented by data assets spawning and attaching the actor
of course sim proxies must know about it too, but that's besides the point
Damn thats exactly what i wanted to avoid
Its a bit too decentralized for me, i wanted to shove all Server/Client logic and meshes into one single actor
actors are things (well, unreal things), real life is about data
Yeah i need to rewrite i guess
you can definitely have all of the functions and things inside of the actor but from passed in to a "local only" actor that either takes in predicted data or replicated data
I actually used the same model for fp/tp and attached it depending on client or local, as soon as its attached i access the datatable and replicate it to the client , proxies and the server itself
DA*
also frankly, if this is a co-op game
just keep things that are hard to predict auth only
I say this having shipped at least one
No it runs on a ded.
does push model replication really leads to significant performance improvements ? or is it mostly a gimmick?
yes
turns out sometimes running code is faster than always running code
Iris also probably reduces overhead significantly in bad cases but I have never profiled it
of course you can just profile the netcode polling stuff yourself in your own project, if you don't see it pushing the main thread very far then #whocare
@cobalt notch Hi did you ever tried the GAS Companion plugin? Looks very interesting, whats your take on it? There's a part of me saying "Why r you looking for shortcuts, do the work and you'll learn some C++", while the other one "Are you sure that all that information's are needed to create your game? This will put in standby every project for a while..." something like that π
Ahackchully!! Epic says in some cases iris might be slower than non iris methods
its left to us poor folks to overhaul our code base and test one or the other π€‘
Changing to iris is a few cvars
also it is experimental anyways
Also yes, it is your job to make the video game (I assume)
and weigh the pros and cons of technical choices like this
oh crap no wonder my game isn't being made
FWIW Iris is not as simple as on/off, it will require remaking your custom netserializers and dealing with some subtle onrep ordering differences
but if the point is "this sucks, I thought it would be strictly better in all cases" I can understand the frustration
how does it deal with blueprint variables?
also if there are BP accessible variables do they need their own getter setters to mark things dirty on cpp side
I'm pretty sure the BP setter marks it dirty... I don't really know exactly as I don't do many replicated properties set in BP
If they were only changed in C++ then I assume you have to mark the property dirty
Hey, sure thing. The widget is created in Player Controller, which passes a reference to player character in the CreateWidget node.
Now, server works normally, but client looks like itβs going through something that wonβt allow the widget to take in his data for like health, stamina and similars. Iβm trying to access variables in the binding, and up to this moment I only have the character replicating. Iβll add some pics in a bit, just woke up π
It works fine in standalone, and I thought about using the validated get in the bindings to delay until data is accessible, but I kinda understood you canβt use delay in bindings(?) I couldnβt see those nodes
Delays are latent nodes. They can't be used in functions to begin with. The bindings have to finish the same frame.
You'd need to share the code of that. You usually need to ensure you use the right events to ensure the Character is valid. And most of the time you gotta bind to some custom Delegates for knowing when the pawn changes.
Right, a binding is still a function. Thanks for mentioning that out
I will asap! :D
these are the codes, wondering what's the issue :(
and this is the binding. Replicated things are because of me trying out stuff yesterday
I haven't tried Gas Companion. I try to build everything myself and not depend on third party plugins 'cos it complicates things more. If you're gonna try to avoid learning Gas then try to avoid using it too. This means it's not for you at this time. The C++ involved is easy and mostly copy paste boilerplate to set it up and you can do the rest in blueprints but non C++ people are too scared to even copy paste and the rest is just making abilities. Or like use Lyra or some samples it's already setup just make the abilties in blueprint but in a multiplayer game there's a lot more involved than just Abilities. And if it needs many abiltiies than i'ts probably that much more complicated game overall apart from this.. Gas is already a plugin that makes it easier to do multiplayer, so if Gas is too hard then like other plugins on top of this means using cheating to cheat at multiplayer because even cheating is too hard. By this time you have to consider if you're in the right game 'cos all this would be avoided in a smaller single player game.
Btw I'm still learning Gas too it's just scary, not too hard if you follow along tutorials or courses. If ya can do any coding and know some basics or ready to learn this is very worthwhile because honestly Blueprints become really easy once you know some C++. If you just want to make small games then sticking to blueprints isn't a bad idea for shorter projects but if you're spending a year or two on this game then learn C++ and count this as part of your development time. Otherwise you can go in circles forever chasing every big project idea like a dog chasing cars on foot. If you want to release a game every 6 months then it maybe better to do a smaller game in blueprints focussing more on gameplay and graphics 'cos in C++ land you may go down rabbit holes and start making a plugin one day or attempt to make fortnite yourself just because you can. This would even put your 2 year game idea in jeopardy. For other things I usually just watch some videos and take a few days to understand a system and then implement it myself which usually works out but Gas is just scary. I have bought every Gas course ever but been too busy doing other aspects to make the actual abilities yet.
why character snaps while ground detected
it is the phys function from phys flying
was stuck here for a long time
That code'll never execute if your fps is high...
are u talking about my code
{
return;
}``` this
this is in phys flying function
what to do
Shrug
how to send message like that
{
if (deltaTime < MIN_TICK_TIME)
{
return;
}
RestorePreAdditiveRootMotionVelocity();
if (!HasAnimRootMotion() && !CurrentRootMotion.HasOverrideVelocity())
{
if (bCheatFlying && Acceleration.IsZero())
{
Velocity = FVector::ZeroVector;
}
const float Friction = 0.5f * GetPhysicsVolume()->FluidFriction;
CalcVelocity(deltaTime, Friction, true, GetMaxBrakingDeceleration());
}
ApplyRootMotionToVelocity(deltaTime);
Iterations++;
bJustTeleported = false;
FVector OldLocation = UpdatedComponent->GetComponentLocation();
const FVector Adjusted = Velocity * deltaTime;
FHitResult Hit(1.f);
SafeMoveUpdatedComponent(Adjusted, UpdatedComponent->GetComponentQuat(), true, Hit);
if (Hit.Time < 1.f)
{
const FVector GravDir = FVector(0.f, 0.f, -1.f);
const FVector VelDir = Velocity.GetSafeNormal();
const float UpDown = GravDir | VelDir;
bool bSteppedUp = false;
if ((FMath::Abs(Hit.ImpactNormal.Z) < 0.2f) && (UpDown < 0.5f) && (UpDown > -0.2f) && CanStepUp(Hit))
{
float stepZ = UpdatedComponent->GetComponentLocation().Z;
bSteppedUp = StepUp(GravDir, Adjusted * (1.f - Hit.Time), Hit);
if (bSteppedUp)
{
OldLocation.Z = UpdatedComponent->GetComponentLocation().Z + (OldLocation.Z - stepZ);
}
}
if (!bSteppedUp)
{
//adjust and try again
HandleImpact(Hit, deltaTime, Adjusted);
SlideAlongSurface(Adjusted, (1.f - Hit.Time), Hit.Normal, Hit, true);
}
}
if (!bJustTeleported && !HasAnimRootMotion() && !CurrentRootMotion.HasOverrideVelocity())
{
Velocity = (UpdatedComponent->GetComponentLocation() - OldLocation) / deltaTime;
}
}```
Heya's, quick question:
I just tried my game as a listen server, and to my surprise all pawns seem to be replicated, even though I'm using Pawns and not Characters
what to do now
Is replication built into Pawns as well now? Or is it just offline and I need some other setup for real online tests?
what time does this happen?
i dont know looks like you halted the movement with air control and facing the opposite direction
when in custom movement mode
trying to do similar stuff as phys flying
this is the code
same that of phys flying
wanted to make a wall run
but this happens
just copied the phys flying and thats it
Where am i???.... Oh #multiplayer sorry i might not know anyways maybe if this video looks right to you then feel free to ping me
zerel is right, this is the multiplayer channel, try over in https://discord.com/channels/187217643009212416/221799439008923648
im doing it for multiplayer But will keep in mind
Right but your problem about c++ code, they'll probably be able to help you out better π
Is it possible to implement NeSerialize on a struct that already inherits from FFastArraySerializerItem?
My find session node cant find sessions until a few tries, like I am getting the succesfully completed string but no servers until a few tries
Is there anything wrong here?
You need to drag off the success tab not the top one.
My dumbness is immeasurable..
Thank you very much, that solved it
can you go from a server rpc, to a owning* client rpc, and then from there call a server rpc?
nvm, im tar tar
What's the deal with voice chat needing explicit integration with online subsystems and sessions? Can't the server and client just send voice data back and forth with the rest of the game?
Also, how can I set it up if I'm not using an online subsystem and just using dedicated server connection
Didn't I already tell you that this Session requirement can be worked around?
All it does is check if there is an Entry in the NamedSessions array.
You have to add that fake Session to the NamedSessions Array. Then it will pass that condition and send the Packages just fine.
Then I read somewhere that vc goes through the subsystem separately
I'm just overall really confused
When testing that I got my multiplayer functionality right, at least in the editor, do I need more than 1 client? I imagine that in order to be comprehensive I want both the listen server, and two clients. That way not only do I get to test how differently the client and the server behave, but also I can test how two clients see each other?
Yeah you got it right, you need to test every scenario
That would be 3 players for listen server and 2 for dedicated
To test everything
yep, but 1 player as a client will create a dedicated + client too
so yeah of course you need more than one player to see stuff. You can see more options in the editor settings -> level editor -> play settings
you can even make them all separate processes to make it even more realistic of a test but YMMV
Hello, I have a problem where on the server/client combo, a moveable static mesh is in one location, but on a client that is connected to the server. the same movable static mesh is in a different location. Is there a way to fix this?
Okie dok. Iβm mostly trying to make sure there are no corner cases Iβm missing such as client-to-client