#multiplayer
1 messages Β· Page 456 of 1
You could do your own separate SetAim() RPC method before firing
so the player calls setAim, which calculates
then calls the Fire function
is that what you were thinking?
Yeah.
You're going to want the pawns to know where each player is aiming anyway, for animation
Might as well continuously tell each other that.
pretty sure Im doing something wrong
(ignore the red lines intellisense is stupid)
I was thinking, dont we want to do these calculations client-side?
So I probably shouldnt just run the calculations server side like Im doing in the picture
Yeah, you would calculate the hit location outside SetAIm
SetAim would just store it for the next Fire() call
uhm.. you mean calculate hitlocation at the start of the function?
outside the role check
Then my question is where do I calculate it, because its calculated only when I press my left mouse button
Currently SetAim is called when I press the left mouse button
Just do that
I'm just saying pass HitLocation to SetAIm
And calculate it before calling it
The issue is that Im calling SetAim from the character class, while the calculations are happening here in the weapon class
so set aim is called in a different class
Im probably misunderstanding you, sorry
Perhaps you mean pass it an empty Vector, which it can then use to store the hitlocation?
An empty vector that I create in my character class when clicking my mouse
Im so confused π
{
Fvector HitLocation;
return GetCrossHairHitLocation(HitLocation);
}
void Weapon::SetAim(FVector HitLocation)
{
// if role autonomous proxy then call server etc
CurrentAimLocation = HitLocation;
}```
Then in Tick
StAim(HitLocation);```
Then when you fire
Fire();
Fire would use CurrentAimLocation internally
ServerSetAim would be like you made it earlier
GetLookVectorHitLocation uses Out parameter
so I wouldnt have to return anything would I?
in my CalculateAim
Yeah sure
Looks fine
I wish it worked though π
Guess Im restarting the editor
Doesnt work, Im getting this warning - LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor Rifle_BP_C_1. Function ServerSetAim will not be processed.
Rifle_BP_C_1 is the servers weapon
Well, right now the remote simulated weapon for the server, on the client's machine, is trying to set aim on server
add if role == autonomous proxy on tick
Erm
if role != simulated
No more warnings, but still going to servers crosshair π¦
So what does Fire do now ?
Im using current aim location, which is a vector in the weapon class
So the code in SetAim, where we do CurrentAimLocation = HitLocation is somehow still the servers
Which is true
because we only reach that piece of code if we are the server
shit
You don't want to set CurrentAimLocation with GetCrosshair
Just use that as a (client-provided) result
Okay removed, still doesnt work π
thats all the relevant code on pastebin, incase you dont want to keep looking at pictures
any way to play in multiple processes without one connecting to the other?
Disabling Use Single Process only allows selecting Play as Client and Play as Listen Server
then it breaks stuff cuz it tries to connect
Dunno @past rain should work like that
Damn :/ I really want to get this to work, then I'll spend the entire weekend studying hwo it works
Any chance you'd look over it via screenshare?
No, sorry
Sucks to get this far and not finish it : <
@bitter oriole Didnt notice this at first, but now the clients works perfectly
however, now its the server which projectiles just go to a fixed position
basically towards origin
So the roles have kinda switched where the clients work, but hte server doesnt now
Sounds like CurrentAimLocation isn't well set on server
ah nvm this is because I cahnged it from Role != Proxy to ==
Its still the issue of CurrentAimLocation being that of the servers, even when the client is shooting
Nice to see someone took over helping while I was gone
We got somewhere evo
but it still isnt working π
Basically trying to calculate the linetracing on the client side
and passing it to the server
Yes, well.. you kinda just jumped into networking face first
yeah I did
I promised once I get this specific part done, to study it well
before moving on
First and foremost. You just need to do everying on the server for right now
Linetrace on the server
add input on the server
shoot on the server
bullet count on the server
ect
Once you have that down, you can spread out
I did have it down
Well, you helped me get it there
where all of that is only on the server
thats what me and stranger tried
ah
but hte way I had it before, was all on server
however the issue was since the linetracing was on the server, it line traced from the servers camera position
Okay, something else you need to pay attention to
So check this
remember how we had to check the entire chain of ownership to make sure we are replicating the correct player/server?
I remember
Alright, well
Functions are the same way
You need to start at the first part of the chain
and follow it
Beginplay is the start of one chain
keyboard/mouse input is another chain
overlap/hit events
ect
if any part of that chain, is mis-matched. the rest of the chain wont fire correctly
So
check:
Mousebuttondown (client) -> Fire(server)
Fire: Linetrace, spawn bullet, set owner of bullet to player's controller
Open bullet BP
make sure everything is set to replicate
ALSO Fire() should be taking a player's controller as input
wtf
hold up
what
The character
Okay, which is a client only event right?
Ever seen the server press a mouse button?
I havent
Then how the hell is this supposed to work?
We still enter that function, Ive logged shit in it
But
ever
dude
just move all of this
if (Role == ROLE_Authority)
{
FActorSpawnParameters ActorSpawnParams;
ActorSpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButDontSpawnIfColliding;
SpawnedProjectile = Cast<AProjectile>(UGameplayStatics::BeginDeferredActorSpawnFromClass(this, Projectile, FTransform::Identity));
SpawnedProjectile->Instigator = Instigator;
SpawnedProjectile->SetOwner(this);
FVector MuzzleLocation = WeaponMesh->GetSocketLocation("Muzzle");
FTransform SpawnTransform;
SpawnTransform.SetLocation(MuzzleLocation);
FVector Location = CurrentAimLocation - MuzzleLocation;
SpawnedProjectile->InitVelocity(Location);
UGameplayStatics::FinishSpawningActor(SpawnedProjectile, SpawnTransform);
CurrentAmountOfBulletsInMagazine--;
}
}
to
inside of this
ServerFire();
ServerFire_Implementation?
Just because client 1 has authority, does not mean you need to program that way
you want to make a bunch of if's for player 2?
no
pretend its all dedicated server
Fire() : Role < Auth, should still be true
for a single player listen server
it will fire twice
Isnt the though that, if Role < Auth is true, it calls ServerFire, ServerFire then calls Fire as a server?
yes...
Thats how it used to be
no
i missed that from the beginning
I don't play with listen servers much
Honestly, I don't believe you need to program differently, between a listen server and a dedicated server
that makes no sense
I did what you told me, now the server/client cant shoot at all, and the client2 still goes towards server crosshair
a listen server is like a server and client
its not
its almost identical
If you program it as dedicated, its the same for listen, but from listen to dedicated its a bit differnet
a listen server, should fire two begin plays for itself. One as the server, one as the client
You need to start at the beginning of your function chain
and start something like this at every function
still cant get it to work
<
do I have to do GetLifetimeReplicatedProps for a variable here?
if role = auth
print auth
if role = autonomous
print autonomous
if role = simulated
print simulated
Last but least you should be doing all of this in blueprints, you could take a single screen shot and have all the data I need to help
I don't know why you are trying to learn all this and do it in c++
Yeah I havent gotten used to the idea of prototyping in blueprints
where the iteration times are shit
I'll prototype stuff in blueprint from now on, just wanna get this done in c++ though
since Im pretty far in it
Also the print stuff you said
where do you want me to put taht code?
Make a global function
Call it Whats the fing role
and call it, at the beginning of every function you are having issues with
brb
Let me explain what i think is the issue from my side. I dont think it has anything to do with ownership, that's all good for now. The problem is, Since we do the firing on server side only. That when we calculate the line tracing, it will use the server's (since in this case it's a player too) Camera to get the starting location, So the end result will be that if any other client fires, it moves towards the servers crosshair
But in the case where its a dedicated server, and the server is not a client, then the server wouldnt even have a crosshair or a camera, so Im not sure how the linetracing on the server would work
Which explains why when I run the game on a dedicated server, the line tracing fails and the projectile just goes down to the ground
So when Im calculating the line tracing server side, I need to somehow use the client that shot as a starting point
INSIDE PLAYERCONTROLLER :
ServerFireClient(Actor Input) : call ServerFireServer(Actor Output)
ServerFireServer(Actor Input):
Get Actor : Get location : Do linetrace : Spawn : Assign (self, playercontroller) as owner
INSIDE ACTOR:
OnMouseButtonDown:
if role=auth : Actor : GetOwner : cast player controller : call ServerFireServer(actor)
if role <auth : Actor :GetOwner : cast player controller : call ServerFireClient(actor)
If you use Getowner -> Cast player controller, you never have to use GetPlayerController(0)
@past rain
I dont really want to do input in player controller, thats not how epic does it
fine
put it in the actor
either way
I could write it up in blueprints in 2 minutes
Are you at home now?
sure
Is there a way to use cheat manager with dedicated server? Specifically the built-in commands like Teleport(), which rely on the player controller. I made a function which can relay the commands to the server and execute them there, but of course the server doesn't know which player controller to use
Also afaik, CheatManager should not be able to use replicated functions since it isn't an actor, but it has one anyway.
EvoPulseGaming is awesome, just putting it out there
networking in a non-dedicated server game: does the server tickrate match the server player fps? if not, how is it set, and if so, is there a way to limit to say 60 tick? cheers.
@gusty lily It does
Any way to keep it regular or limit it without limiting server player FPS?
Hmmm. Thatβs a some encouragement to economise right there. I wonder at what FPS things start to fall apart. In my genre people lie to run at 120+. I might have to build in that limit for server players at least.
Hi guys, can anyone help me with this
I'm spawning an actor, just a static mesh really in my level, when I put my server into dedicated mode and say 2 clients, everyone can see this static mesh
Now I want to scale this mesh while the game is being played
I'm spawning it via the server, however, when I change the scale over time nothing happens
It does work in 1 player, non dedicated mode
I've tried replicating the vector that's responsible for resizing the static mesh
But nothing helps
At least, I'm sure it is scaling on the server because I check this with an overlapping event, the static mesh's scale does not change visibly
For context: I'm checking if a player is overlapping with a static mesh, the static mesh is like a battle royale safezone, if overlapping no damage is dealt, if outside player is taking damage
scale doesn't get replicated by default, since it rarely changes
replicating a vector representing that scale, then setting the mesh scale OnRep will do the trick
Ah ofcourse, forgot to set my MeshComponent to SetIsReplicated(true) besides bReplicates = true for whole class. Works like a charm now, thanks alot @winged badger!
lol
So I have a client on dedicated
I spawn an actor on the server, and set the client's playercontroller as owner
on the actor's beginplay -> GetLocalRole
I get Simulated Proxy... which is dead wrong for the client
If I do
GetOwner-> GetLocalRole (which is the player controller) I get Autonomous Proxy
Help?
@glacial pollen You need to set autonomous manually if the actor supports it
autonomous is generally for pawns
I don't do anything else but I guess it works in BP
void APAwnClass::PossessedBy(AController* NewController)
{
Super::PossessedBy(NewController);
// Set the correct network role
if (GetNetMode() != NM_Standalone && Cast<APlayerController>(Controller))
{
if (Cast<APlayerController>(Controller)->GetRemoteRole() == ROLE_AutonomousProxy)
{
SetAutonomousProxy(true);
}
else
{
SetAutonomousProxy(false);
}
}
}```
Bit of a moutful
Yup
O..M..G
Sometimes I really question the sanity of the developers at unreal... Other times I question my own for putting 4 years into this game.
So check this bullshit out:
SpawnChar(Set owner as PC)
Char Begin play : simulated
possess
right?
if I put a DELAY node, in the begin play
I get autonomous
because when you spawn, begin play happens before you can posses it.
So now I need to split up my code even more, on possessed, with a merge with begin play. Because... guess what? You can spawn the character for customization, and you want to look at it, not control it
Why do we not set Autonomous by default? Why does it matter? Its not like we are saving a few byte by changing from one enum to another
@glacial pollen There can be no way for the engine to ensure possession before beginplay.
If only because the pawn might be in level and you possess it when you connect
I dont mean that
I mean, why are we not setting autonomous by default?
Why does it matter if its possesedf?
Autonomous by default would simply be wrong. If no one's possessing a pawn it can't be autonomous
why not? I own it, and have semi control over it
Autonomous = remote player not on server actively controlling this pawn
If a pawn is created and not possessed, it has to be simulated
why does it HAVE to be pawn though?
why can't actors be auto?
You know how confusing this is now?
I can run server RPC's on a simulated proxy!
Everything I was ever told is a lie kinda deal
Simulated = server-controlled object, basically.
If you want to "control" an actor, sure, set it to autonomous
okay, so then how about this
How do you tell the difference between owned-simulated
and not owned simulated?
Everything defaults to simulated, because in a video games, 99% of actors will be
Generally everything but player pawn
thats fine
but I want some code to run only for the owner
but getlocalrole is simulated for everyone
Then test by owner
Not by net role
The net role is basically a permission, it's a safety to prevent cheaters from calling RPCs everywhere
Makes the netcode way simpler
So the server, spawns an actor, and see's it a auto for the remote, but the client see's simulated?
because my rpc calls still work for the client
Are you looking for IsLocallyControlled() ?
that = possesed
I have a character, I spawn, from teh server, for the client to prevent cheating
but its for customization, so I don't need/want to possess it
I call bullshit
Use another actor, like player controller
You can spawn actors locally on client. I do it too (for bullets)
Ah, right, owner is enough for RPC
actor != character or pawn
I guess I can pull the owner, and then call my getlocalrole
@hoary lark You can do it but you can't spawn a posses-able pawn on client
I still don't understand why we can't just set the role to auto for everything the client owns
like what can it do wrong?
Like, if I can run RPC's on simulated because I own it, why do we not just call it autonomous?
You're free to do it yourself
I'm just trying to understand the reasoning for this
Does autonomous run special code or something?
Autonomous is basically "pawn possessed by remote player"
That's all it's used for
Huh, that was a bit confusing. Didn't know that. I'll now investigate where/when the AutonomousProxy role is set.
In APawn::PossessedBy, it sets the AutonomousProxy on the pawn.
Hey all quick question from a noobie - for multiplayer, where do I setup variables that I want to be unique to each player (Like ammo that they have on them)?
you don't really have a restriction on that
I was really hoping you wouldn't say that @winged badger ... Currently, when my or server reloads, they both take ammo from the same pool (but oddly enough not from the 'ammo in the gun')
my client*** or server
in that case your ammo would break in single player as well
in single player it works perfectly - somehow, they're both accessing the same pool of ammo - do you mind if I take a screenshot to show you? I feel like there's something simple I'm missing with multicasting
just paste it here
@winged badger thanks man! So I've been doing some experimentation with different replications (multicast vs client vs server) - I only seem to have found one that lets the client actually reload (unfortunately with the same issue of sharing an ammo pool)
I'll post some screenshots in a sec
This is the reload event I call from the base character I use for all my child actors
This is the reload event stored on the base weapon I use as a foundation with lots of variables for each weapon in the game
Second part of the graph there in case you'd like to see...
Thanks @winged badger - I really appreciate any kind of feedback! π
Oh the experimentation - on the first screenshot... If I set ServerReloadGun to Multicast, the server uses the shared pool, but the client can't reload.
It doesn't seem to matter too much what ReloadGun on the base weapon is set to, it always shares the pool - however the closest to the desired result is the screenshot I pasted first - as it plays the sound and animation for the client (animation isn't replicated to server tho :?) and the reload sound plays.
What makes it also strange is that the "reload time" variable you see there changes depending on which weapon the client or server are using - in other words, the reload time is independent, but the shared pool of ammo isn't.
I take it no1 here knows? I am pretty stumped. Wonder if I should do the whole ammo system over
@fossil sentinel this looks like it would cause a lot of issues
no need for a multicast here unless youre trying to replicate sound or animation
and then everyone running it is going to get player character 0 which is their own character
There is really no need to fire a Multicast here
Performing the reload stuff on the Server is enough
And then maybe a Multicast if you want to play a reload animation
Thanks guys - you see that multicast lets the animation and sound play for the client as well, but doesn't seem to impact anything else. Setting it to run on server still takes ammo from the 'shared pool'
@graceful cave thanks for the help, could the issue be that the Player Character is set to 0, and should be dynamic depending on which player calls it?
where are you running this at?
if its on the character you dont need to cast anything
if its on the weapon try getting the parent actor or something
Yea that's on the weapon. The function is called from the character that is assigned the weapon on spawn
Let me see if I can try get the parent actor or something along those lines
set a variable on the weapon that stores a pointer to the character when the character is assigned the weapon
and use that
I thought of that too now, but I have no idea how to get that reference... maybe setup a reference to self in the character, promote that to a variable, then cast to character in the weapon and get the reference?
well if you could get the character to get that variable you wouldnt need that variable
is the gun a component on the character
Ok I tried my roundabout way above and it doesn't work. Makes things worse haha
No the gun is a base blueprint that is attached to the character on spawn.
how are you attaching it to the character?
you should already be getting a reference to the character somewhere if youre able to attach it
This is how I am attaching it in 0_base class
create a 0_base variable on the weapon and set it to self here
also you should instead have only the server spawn that weapon
and make sure its a replicated actor
because that setup will cause all clients to create their own weapon for that character
and replication wont work properly
so only the server should run that
and what you can do then is create a 0_base variable on the weapon and check expose on spawn
that one
so it shows up on the spawn actor node
and set the value to Self
as long as the weapon is set to replicate in the class default settings for the blueprint, clients will have the value of that character when the actor replicates and they run begin play
the 0_base variable will also need to replicate
so on begin play in the weapon, you can then handle the attachment there instead of on the character
that way all clients and the server have the same object for the weapon and then you can properly replicate variables and call RPCs on the weapon
oh my gawd... so this whole thing is kinda screwed up ><
yea lol
I thought I was doing well xD
easy to make a lot of big mistakes like that when learning mp though
OK - so call a server function on event begin play in 0_base to spawn the weapon. Then attach the weapon in the base weapon. Did I get that correctly @graceful cave ?
Lol im struggling with the exact same thing. Re-reading cedrics compendium pointed me in the right direction tho
@fossil sentinel dont call a server function because the server is already running begin play
use this
should be begin play on character -> check if server -> spawn weapon and set 0_base var to self via expose on spawn (make sure the variable is replicated) -> begin play on weapon attaches itself to that 0_base variable
Ok... can't attach the 0_base variable because the Parent Socket on AttachToComponent is not compatible
I can maybe get a mesh reference?
This is the error
hmm ok so it's spawning, but it's not attaching
I casted to get that ref this is my current setup (i changed This Character for Character Mesh)
btw this is making SO MUCH sense as to why when I debugged I had to guess which of the 4 weapons my character was using lol
player character 0 will always return the local character and nt the character youre trying to attach to
is this on the weapon?
yes this is on the weapon, that's why I have to cast... maybe get player pawn?
show where you spawn the weapon
I spawn it in 0_base
the character variable needs to be on the weapon
not on the character
the spawn node should look like this
thats where you use Self
this needs to be on the weapon
Well I have that variable on the weapon... how did you get Your Character pin on the SpawnActor?
He literally showed you in the screenshot above
i'm using a widget to interface to a door & elevator, and the widget in MP doesn't fire off at all with server or client clicking on the widget button from their widget interaction component. what could fix this?
I assume your Door/Elevator has the RPC in it and it doesn't work for Clients?
This correct?
I'm sorry guys - I'm trying here. I had to create a new one to get the pin π
You can't call RPCs in non-client owned Actors.
@grizzled totem
ServerRPCs in an Actor that the specific client doesn't own won't ever reach the Server.
Neither will ClientRPCs from Server (cause there is no specific owning client.
You can't directly go from Widget to Door to Server.
Ok. Hmm thank you. its working in SP atm but wasn't sure what all it would take to have it work in MP.
i figured itd be alot haha
That#s why people say: If you need Multiplayer, do it directly.
I was having a time just getting the Widget to finally use the interface right for operating the door and elevator separately.
Yeah you'll have to route your logic through something client owned
Like the PlayerController
Widget -> PlayerController -> Server -> InterfactWithDoor
Okay. Thanks i'll look into doing that to get it working in MP and might be back.
Hi guys - anyone know's if something changed regarding local multiplayer and player controller dispatching in this regard?
Because UE recognizes all my controllers only as controller 0
hello all, I have just recently started making a game. I have a dedicated server for it going. The problem im having when the game connects is the game is frozen and the server log window gives displays this over and over again can someone help me out?
the server is on one pc and the client on a different pc
Hey all, can anyone please help me with this seemingly very basic multiplayer sync issue?
My client doesn't see the first update of the text render component on this AI character.
It still sees the health value as 100, even though the print string is suggesting the client does actually know the character's health is really 90
This is the AI char's BP:
I'm shooting it with a projectile:
The second time the server shoots the AI, the text render updates, but it stays 1 shot out of sync:
might sound like a stupid question but im new to UE4, but how do I add background music? lmao
@inland rain shouldnβt be in #multiplayer but... in BP you can do they play sound 2d feature which is useful for background music
oh s*** didn't realize this was multiplayer lmao
Hey guys, I might be missing something but, for whatever reason, once I posses a pawn client side, the actor seems to move only on the client that possessed the pawn. I do an RPC when possessing the pawn and when I unposses the pawn (also via RPC) I get sent back to the location I originally possessed the pawn. Any thoughts on why that's happening?
Ow I see, it's not enough for the client to have the replicate movement ticket. The movement RPCs also need to be sent over
how would you guys go about running a multiplayer ready game as a singleplayer player please ?
Handling the Singleplayer just as a ListenServer
so using server travel etc ... ?
Yeah that should all work
Just don't create a session and neither start with ?listen
ok thanks
If you iterate over the same player controllers after traveling to different maps, will they always return in the same order?
Hey guys, PlayFab not run here
Someone using PlayFab in UE 4.22?
Severity Code Description Project File Line Suppression State
Error C5038 data member 'UPlayFabAPISettings::DisableAdvertising' will be initialized after data member 'UPlayFabAPISettings::VerticalName'
You can perhaps try edit this .h file and fix on the error.
The error points at/around line 21, tho i have no idea what could be there. But with a bit of trial and error it may be possible to flip the order of these defined properties and the error should go away. Or you can wait for official fix.
True, I go try here
Compiled here, Now I go try if the demo run lol
Thanks @rotund sapphire by your help.
You're welcome. Hope you are keeping a backup of your project just in case.
ok π€
i'm having a weird problem
my multiplayer project used to work but then it suddenly stopped working
i have to versions of ue4 installed ue4.19 and 4.21
but weirdly enough none of them seem to support it
the only way i can open the project is from the .uproject file
also now the join session node doesn't work
firewall may prevents your editor to use networking features, or perhaps you should enable 'dedicated server' in the play options if that's the default for your project
it works on editor
but when packaged the join session node doesn't work :(
it used to work tho
and i've changed nothing of the create/join game blueprint
it doesn't work in mobile to mobile
or in computer to mobile
or in computer to computer...
I have trouble finding documentation for Advanced Sessions plugin. Can someone give me a useful link please?
I'm trying do understand what "Min slots" parameter is supposed to do and what filters I can use for Find Sessions Advanced BP
The AdvancedSession Plugin is created by a specific user. You should just contact them or check their forum thread.
ok I will try that. Still , can you explain me what Min slots in Find Sessions Advanced does?
Hey, I was wondering how much can I customize the dedicated server generated by the UE? What if I want to customize the packet form, or I don't know let's say I want to use TCP rather than UDP (bad idea I know, but let's say that)? I feel like networking in UE is very hard to customize, please let me know I'm wrong π
I am asking because I would like to use a dedicated server from my own... But the thing is it would take quite a lot of effort to reproduce the "positioning authority", that is reproduce the fact that a player cannot go through walls, hills, etc. because I think it requires to parse the map or have some kind of geodata. So using the dedicated server of UE is definitely a good idea, however I would like to be able to tweak the networking of my dedicated server and client at most...
If anyone is familiar with networking in UE, let me know π
(By the way I see no #networking channel here :p)
Hey guys. I've started to work on a multiplayer game project but when I was creating the server hosting and tested it, I got 2 errors. First, if I click on Host button and test with 2 windows, in both windows the players spawn to a certain map without having to press "search game" for the player that wasn't hosting. Second, they might be in different worlds or something, because when they spawn, they can't see each other. Here's a video that includes my blueprint script and the errors as well, please check it out and help me if you can: https://youtu.be/tVg4jYxlZjY
would that be a good idea to store a character index in a player state to actually let the server now which class he must spawn for each player ?
you mean a player index? I can try that actually but there should be another way I believe
oh sorry I wasn't trying to answer, I have actually no idea of how to help you out :/
no problem, I will try to do something with indexes if no one answers
I've tried so many methods and spent so much time on this but I'm missing something for sure
good luck
thanks, I'll wait for a while to see if anyone has any ideas I just don't wanna mess up my code even more
@modern token to be blunt you're reinventing the wheel and there's no reason to and your assumptions are incorrect.
If you're that unfamiliar with the engine then you should focus on learning it first
The reason you're not getting a reply is because your question is the type that generally leads to continuous newbie questions about an advanced and frankly pointless topic
Maybe start with Cedric's compendium and build a small game or two then come back to it
Wasnt it always?
Cant say i noticed any difference
Hmm maybe its my hacky setup that always was shady then. I always needed delays on stuff to make it work properly because it was so slow
does anyone know if the message bus can communicate over pipes instead of UDP?
hmm seems everything may be in Engine/Plugins/Messaging, just see TCP and UDP
@lilac gazelle how long does it take for OnActorChannelOpen to be called?
and have you increased bandwidth limits?
prob not
Using plugin?
Cant see why it would matter but
If this happens for me aswell im definetly downgrading
4 ish sec or are you using a timer?
Timer then i guess
do animation blueprints automatically replicate?
Have you tried calling the beginplay manually?
Was pretty sure i just saw the node...
@lilac gazelle have you tried on a blank test project (like third person template)?
Any recommendations for a dedicated server In EU ?
I have an issue when i try transferring a boolean from client to server. It's supposed to show that Player 2 is ready to start a match, but when I check it on server it shows that boolean "player 2 ready" is not activated. What am I doing wrong here?
I have 0 idea how to transfer variables from client to server
is this variable, ready, set to replicate?
Hi guys. I have a vehicle which has a canon weapon firing bullets (currently only working for single player)
what is the best way to replicate it for best performance and least lag?
I was thinking owner client can fire his own bullets and send RPC to server to fire bullets as well so the bullets get replicated to all others except owning client
but my game has up to 16 connections at the same time
will this be the best approach?
Anyone who knows how to build a dedotated server very easy?
It's never very easy since you need a source engine
If you need a dedicated server you're not near "easy" in the first place
Do you really need a dedicated server in the first place ? If you need tutorials you're probably not doing the next Fortnite
No offense
Listen server goes a long way, it scales really well
You basically don't need to think about servers anymore
It makes cheating easy, but unless you plan on buying some solid anticheat tech, people will cheat anyway
I need somesort of online multiplayer
Doesnt really matter what kind of servers
As long as people can play togther on internet @bitter oriole
@viral raft Then you really should look at listen servers. Basically one player hosts the game
It's not a great idea for a PVP game, or a large-player-count game, but it's free, doesn't require complex setups, doesn't need hosting servers, protecting against attacks, etc
@bitter oriole Yeah but listen servers need portforwarding for the hosting player right?
Or can it be like steams p2p system without port forwarding
Steam should enable NAT punch which makes port forward not required
Am currently using listen servers, but relying on steams backend, and since i release on discord first its a no go
so i need smth different π
Discord has a game sdk, but i am not understanding C++ yet. So its hard to implement for me
I know C#, but its complete different π
DOn't confuse Steam / Discord (sessions) with your multiplayer setup (dedicated, listen)
Completely different things
Steam doesn't host anything
No i know
But am currently relying on the steam backend for matchmaking
Which is not allowed when publishing on discord
So i need to change the system, thats why i was asking for dedicated servers
@grand kestrel Well thanks for you honesty I appreciate it. I think I just wanted to go too fast, and right now I feel like I'm just moving the problem further in time but... Although I already read the nice PDF from Cedric, I will follow your advices. Thanks.
@viral raft Matchmaking and dedicated have nothing to do with eachother
So you don't need dedicated servers for Discord
You just need matchmaking for Discord
Which they might provide, or not, I don't know, never looked at that store
They kinda do i am right
But since i dont understand C++, and they only have a C++ sdk and no BP its gonna be hard to do hahah
I am messaging my problem again because it's gone a bit up and wasn't answered
I have a vehicle which has a canon weapon firing bullets (currently only working for single player)
what is the best way to replicate it for best performance and least lag?
I was thinking owner client can fire his own bullets and send RPC to server to fire bullets as well so the bullets get replicated to all others except owning client
but my game has up to 16 connections at the same time
will this be the best approach?
Hey guys, what can be the reason for UE to crash as soon as I use server travel with two PIE as long as I have only one everything works fine but two is a big no
try launching it via CMD in standalone mode
Yes. Whenever you server travel, you standalone
oh ok didn't knew that
Hi, has anyone used the Amazon GameLift Client SDK plugin before? Whenever I call UGameLiftClientObject::CreateGameLiftObject from my game instance object, it throws an error:
[2019.04.19-18.36.29:516][ 0]LogWindows: Error: [Callstack] 0x00007ff7cebf33ff ProjectCoreServer.exe!UGameLiftClientObject::Internal_InitGameLiftClientSDK() [d:\github\projectcoreue4\mainfiles\plugins\gameliftclientsdk\source\gameliftclientsdk\private\gameliftclientobject.cpp:11]
[2019.04.19-18.36.29:517][ 0]LogWindows: Error: [Callstack] 0x00007ff7cebf2a17 ProjectCoreServer.exe!UGameLiftClientObject::CreateGameLiftObject() [d:\github\projectcoreue4\mainfiles\plugins\gameliftclientsdk\source\gameliftclientsdk\private\gameliftclientobject.cpp:42]
[2019.04.19-18.36.29:518][ 0]LogWindows: Error: [Callstack] 0x00007ff7cee900e4 ProjectCoreServer.exe!UCDGameInstance::UCDGameInstance()
@reef heath I'd suggest watching my tutorial https://youtu.be/Iq2LpwXogTw
PART 2: https://youtu.be/2I8JDeMGkgc In this tutorial, we're going to show you how to host a Unreal Engine dedicated server on Amazon Gamelift including all ...
does anybody know how you might (or have a link to some resource) make sure everyone joining a session is "ready" before they actually join?
i'm just wondering how i'd go about this using the advanced sessions plugin
basically, i want the user to click "find match", but then ONLY join once there is enough people to play the match
something like how counter strike does matchmaking, except i don't really need the "ready" dialogue, unless that makes it easier
i would just have everyone automatically be ready once they click find match and wait for a session with enough people
Would it make sense to have one master server everyone joins right away when they find match, then the game mode of that server does all the logic, like finding players with similar ping and possibly rank, who are also currently searching for a game, then make all those users travel to an available game server with the actual game match?
Will advanced sessions plugin and steam subsystem already do something similar for you?
I'm having a little issue. I'm starting to implement my first steps of multiplayer in a first-person shooter. If I start the game from the test map, Both my players show up. I have bullets replicating, most stuff works... But If I start my game from the StartMenu map, and then both players click Play, they end up on their own maps and can't see each other. Anyone help me figure out where to look to fix that?
Are you using a discrete server?
Otherwise one of the players will need to host a session, while the other joins it
@median elbow Right now, I'm testing by just setting the Players to 2 in the PIE.
fairly new to UE4 and very very very new to trying anything MP π
How are you connecting to the main map from the start menu?
Does gamelift have a free tier/trial?
The Gamelift pricing page mentions one
so I'm trying to create an array of all of one type of actor in a game which is used to construct a minimap. So i'm simply having the actors call a multicasted networked function within the beginplay function, which will make all of the clients have an up to date set array of actors.
the problem with this is that if a player connects later than others, this function wont be called.
TLDR: Is there function similar to beginplay that would ensure actors created through replication will call?
everyone already runs begin play on any actor that spawns
so multicasting would be pointless
just add themselves to the array on beginplay and new clients will run that when they join
thanks
Does anyone know how to keep smooth movement with something like a melee that lunges towards an enemy?
-
I have tried storing past character locations on the server and lunging towards a location in the past on the server. In order to try to get the server and client lunging towards the same location. This works in the case where there is no collision blocking that location on the server. But fails when there is collision between those points. For example, when the enemy is walking towards the attacker. The rewind location is therefore behind the real location of the enemy on the server. So collision with the victim character blocks the attacker from reaching the rewind location on the server. Thus causing correction on the client. I can't just disable collision in this case because we support listen servers as well.
-
I have tried using
bIgnoreClientMovementErrorChecksAndCorrection=trueto do a client authoritative approach where the client drives the movement and the server just follows. This works except when I flip the bool back to false, at the end of the melee, I still get a very noticeable correction.
Is the best approach just to interpolate the correction at the end of the melee over a few seconds so it is mostly hidden? Wondering if anyone has done that before.
@thin stratus I see you were trying to use PostNetReceiveLocationAndRotation to smooth out corrections. Did you ever get that working?
I just used what the CMC did
void AHLHoverdrone::PostNetReceiveLocationAndRotation()
{
if (Role == ROLE_SimulatedProxy)
{
const FVector OldLocation = GetActorLocation();
const FVector NewLocation = FRepMovement::RebaseOntoLocalOrigin(ReplicatedMovement.Location, this);
const FQuat OldRotation = GetActorQuat();
HoverComponent->SetNetworkSmoothingComplete(false);
HoverComponent->SmoothCorrection(OldLocation, OldRotation, NewLocation, ReplicatedMovement.Rotation.Quaternion());
OnUpdateSimulatedPosition(OldLocation, OldRotation);
}
}
Ahh okay, I'm trying to smooth autonomous proxy corrections; at the end of a specific ability
That happens somewhere else
At least I think so
I think corrections are really just forced
You'd need to apply smoothing when the correction comes in
Hmm okay, I'm trying to smooth it out over a few seconds at the end of a melee lunge. So it doesn't look so awful.
ClientAdjustPosition_Implementation
That is overriding everything
So you'd need to add your smoothing there I guess
Okay, checking it out now
However Idk how needed that is
Corrections should barely happen
Even on higher pings
And it's sqrt(3) of an error
Even if you get corrected, it's barely visible
It's very visible with my melee
I made the mesh move independently from the capsule, so it allows the capsule to pop in place and the mesh will smoothly lerps towards
Since the client and server are lunging towards different locations
Due to latency
@rotund sapphire This is for the local client tho
That approach makes sense for simulated proxies
I don't know how I could get the server and local client to always lunge towards the same location.
The only two options I can think of are.
- Don't start the melee on the server until the client hits the target. This would be strange though since the melee lunge isn't an instantaneous action like bullet fire.
- Disable character to character collision on the server while the lunge is happening so we can lunge to the same location on both the client and server. Listen servers would unfortunately see players lunging through each other in this case tho.
So if they aren't lunging towards the same location then I need a way to smooth out the correction.
All this sounds a bit like early optimization
Optimization? This isn't optimization. This is trying to create a smooth viewing experience for the client.
Like, overly optimizing on the visual experience, but i'm not judging anything here, merely just expressed my thoughts :)
Visual experience on a game should be smooth
No it looks awful without any of this
Which is why I am working on it
A lot of rubberbanding looks bad for the client
My personal take on similar issues, albeit without CMC or anything, is to switch networking off while doing deterministic animation
In my case it's a vehicle landing - there's a "land" event, and then replication stops while the vehicle lands smoothly
That is essentially my bIgnoreClientMovementErrorChecksAndCorrection=true approach.
The issue is that when I flip it back to false after the lunge I get a big correction
So that correction needs to be smoothed over a few seconds to not be visible
Do you have a large correction because of actual differing simulation outputs, or a large correction because of timing / CMC not being aware of what happened ?
I think it is because of timing. I have tried delaying the flag being flipped back to false on the server by ExactPing / 1000.f. Which I thought was working, but I'm still getting a bad correction at the end of the melee if I jump and melee.
With the bIgnoreClientMovementErrorChecksAndCorrection=true approach, I'm not even changing the velocity on the server. I am using ClientAuthorativePosition and changing the velocity on the autonomous proxy.
I don't know the CMC at all but I guess it's important that all players resume networking starting from the same values
So manually set the character location on the server at the end of the melee?
ListenServer?
On a Dedicated it might really make sense to simply trust the client for the animation
And then go from there
I mean, send the attacker's location on the client, at the end of the melee, to the server. And update the character's location on the server to that location.
For listen servers we aren't worried about cheat protection or anything like that. We use dedicated for everything except for practicing against bots.
How would you implement "trusting the client and then going from there", Cedric?
Hm, not sure. The Server needs to know that the client is performing the animation.
And the next location that comes in should then be accepted (if not too much different)
Are there no docs on how SmashBrothers does that stuff?
Smash bros uses deterministic simulation exi
Ethan are you using the builtin character movement system or are you trying to initiate your move based on an rpc?
My server rewind approach used the built in character movement system (with a custom flag).
And my bIgnoreClientMovementErrorChecksAndCorrection approach uses a rpc
Re-pasting for visibility
- I have tried storing past character locations on the server and lunging towards a location in the past on the server. In order to try to get the server and client lunging towards the same location. This works in the case where there is no collision blocking that location on the server. But fails when there is collision between those points. For example, when the enemy is walking towards the attacker. The rewind location is therefore behind the real location of the enemy on the server. So collision with the victim character blocks the attacker from reaching the rewind location on the server. Thus causing correction on the client. I can't just disable collision in this case because we support listen servers as well.
- I have tried using bIgnoreClientMovementErrorChecksAndCorrection=true to do a client authoritative approach where the client drives the movement and the server just follows. This works except when I flip the bool back to false, at the end of the melee, I still get a very noticeable correction.
"But fails when there is collision between those points. For example, when the enemy is walking towards the attacker." Rewinding should not factor in realtime conditions that could affect the rewind. The purpose of the rewind is to simulate the game state of the client at the moment the move was initiated, so you need to rollback and simulate any dynamic obstacles like the other players @jolly siren
When the enemies aren't rolled back, you're creating a potential divergence in the simulation which is exactly what you're seeing
Right, yeah that makes sense. I'm not actually rolling back anything. I'm just using the rolled back victim's location when performing the lunge on the server.
The issue with rolling everything back is it doesn't work for listen servers
You would visibly see the rollback
your server is what? dedicated, vps or? @jolly siren
We use dedicated servers for everything except when playing against bots, in which case we use listen servers.
So ethan if you're rolling back the victim what is the client hitting that's causing the divergence? Other players not involved in the simulation?
Sorry, I didn't explain it correctly. I edited my message.
I'm not actually rolling back anything
I'm just using the rewound location on the server when performing the lunge
So the client and server are lunging towards the same location
ok cool but what is your dedicated server?
But it's hitting the victim in the case I am describing there.
like configurate how, from where and is it paid ot?
We use AWS
what is this from?
no
hmm
What's that got to do with his issue
Anyways, I'm in the middle of getting help with an issue
how to configurate?
@jolly siren So, when you re-enable net, can you log the transforms and compare on each device ?
"I'm just using the rewound location on the server when performing the lunge" So you have two choices here (that I can think of), either 1. Use fully client authoritative lunging with some basic anti-cheat checks or 2. Implement full rewinding and resimulation to emulate a deterministic playback
Right, that's what I'm thinking too xen. The issue with #2 is that it doesn't work for listen servers
I guess the correct approach would be to do #1 for listen servers and #2 for dedicated
where are the prices and how to configurate this server? @jolly siren
@bitter oriole Yeah I can do that. I am experimenting with just sending the ending location from the client to server and setting the actor location on the server to that.
To avoid the correction
@jolly siren here's a breakdown of what I do here on my listen server setup :
- Owning player has full rollback/replay
- Server (also a player) has independent simulation based on input sent by the client, with framerate interpolation
- Other clients get interpolated transforms basically
When I need animation, I pause networking and resume it
When restarting network, I have some processing on the first replicated frames to filter out some errors
Doesn't the listen server see the rollback though?
The listen server can't rollback, he's authoritative.
Only the remote client can ever rollback
anyone to recommend me cheap server? like this aws but cheaper
No
We can't recommend hosting services - AWS is very likely to be the cheapest ever
why?
Depends on your game
ok
Try a few and pick the best
ok
Better yet, don't have dedicated servers π
I want to learn to configurate it and to make request from this computer to the s erver to make multiplayer system and many other things
Okay, feel free to ask questions on particular points that you don't understand from tutorials. There are quite a few on this
I usually recommend the "UE4 multiplaye rmastery" course on Udemy
@bitter oriole To my understanding rollback is normally server side. The simple example is for favor the shooter. So the client shoots the player on his client. But it doesn't hit on the server because the locations differ. So the server rewinds and checks to see if the trace would have hit on the server at that time in the past.
what you mean by "Better yet, don't have dedicated servers"
That's a different kind of rollback here @jolly siren - my rollback is in the context of "rollback + replay", which is always on client, while you describe lag compensation
I have this course:
Ahh okay, yeah I was using more of the lag compensation approach in order to get the client and server moving towards the same point. But it doesn't work in cases where collision blocks obviously since it isn't a real rollback.
I'll need to read up on rollback + replay
@twin juniper Dedicated servers are expensive, difficult to setup and maintain, require care to not get hacked, basic legal guidance to not be illegal in Europe for example, and dedicated servers are only useful if you're doing something way harder than what you should be doing as an indie, IMHO.
Google it
a ok
Listen servers where a player hosts the game don't have any of these issues, at the cost of being unable to prevent cheating, and unable to support large player counts.
You never need listen server, it's just the most sensible approach to indie multiplayer
@jolly siren I don't remember if these specifically cover rollback/resim, but I would definitely watch these talks https://www.youtube.com/watch?v=h47zZrqjgLc https://gdcvault.com/play/1024001/-Overwatch-Gameplay-Architecture-and
In this 2011 GDC session, Bungie's David Aldridge discusses the programming that drove Halo: Reach's online networking. Register for GDC: http://ubm.io/2gk5K...
'Overwatch' uses a cutting-edge Entity Component System (ECS) architecture to create a rich variety of gameplay. Each hero in 'Overwatch' must stand on their own in terms of depth. Blizzard's team leverages ECS to curtail complexity, even as they...
No one's recommending anything at all
they said me that they are the cheapest or I understand them this
Thank you xen. I've watched those before, but it's been a while. I'll rewatch π
so reccomend me cheaper @fleet raven
I thought you wanted cheaper hosting
How do you store the rollback state Stranger? Are you strictly storing locations?
No, I store the full transform, velocity, angular velocity, and a timestamp
The Udemy course I mentioned has a great UE4-based guide to rollbakc and replay for what it's worth
But CMC implements rollback replay, so you don't need to add it if you're using character
Just need to understand how it works
Ahh okay yeah I'm using character
I didn't use character so I had to do it
so recomend me cheaper servers but not listen-okay? this is better I think like explanation
@bitter oriole Can you explain how rollback would help with my melee?
I will work with windows
Windows dedicated servers is just nonsense
u can build a linux server on windows
im currently working on making a video on it
altho there is a good article about how to do it
It's in the official engine doc
Can you start by reading that ?
You'll work much faster by figuring it out yourself
Ethan from what I can tell it enables state consistency at the beginning of the attack, so therefore you won't have to be corrected after completing the attack.
"UE4 doc linux" on Google ?
"Cross-compiling for Linux" is the actual doc page
@jolly siren Well, I have no idea how your melee is implemented, and I have little experience with CMC. However, you should be able to suspend CMC when starting the ability, then telling the CMC at the end of said ability where you are know - velocity, location, rotation - before restarting it. The important part is
A) having deterministic animation
B) resetting the CMC state to a common state
If you do that, you shouldn't get a rollback
In the event of an inconsistency, do you favor the client stranger?
No, I favor the server, so the client rolls back
Though the client is permitted some leeway because it's impossible to be fully deterministic on PC
Hm, then I think he'd be in the same position as he is now
I think ethan's issue is dealing with inconsistencies
The point is that inconsistencies shouldn't happen in his case.
Either they don't really exist and CMC is either not behaving, or not driven properly ; or they exist and the animation isn't fed the same parameters or something like that.
If your client was in sync before animating and is not in sync after, it means one of these things
Dealing with inconsistencies is a thing but that's not really the issue here, the issue is preventing them
Yeah that makes sense. I'm strangely getting a correction still sometimes even when sending the client's ending location to the server and setting the character's location to that. So digging into that now.
I'm going to check out that udemy course too
I usually put tons of log in the movement component to get a detailed overview of what happened - like two text files aside each other with the same action on the to machines
Usually it's quickly clear what happened
I really appreciate the help xen and Stranger π
@sharp pagoda Have you done interpolation for the autonomous proxy to smooth out corrections received from the server?
@jolly siren No, but the CMC has that built in if you're looking for a reference
Half sure the autonomous one just gets a hard override
Ah yea it might, it would be fairly easy to implement similar smoothing to the simulated proxy solver though
Yeah it feels like autonomous proxy just gets set to that location without smoothing
It's strange that I am still getting corrections when I am literally sending the client ending location to the server and updating the server location before flipping bIgnoreClientMovementErrorChecksAndCorrection back to false
If you need interpolated adjustment, make sure you have a hard limit where it will override the lerp solver and set it directly if ||discrepancy|| > 1 meter or something
Makes sense, I just hope I can find what is causing the correction still
How much movement happens in the period right before you initiate the lunge?
That is what seems to be throwing it off. When I jump and melee
Does the correction still happen even when both players are still?
No, I've only seen it if the attacker jumps before meleeing
So yea it's probably a processing order issue
so I didn't understand for cheaper servers? not listen servers
The jump was simulated on the client but not yet on the server
It's actually weird that executing the animation corrects you
You would need to add strict ordering integrated into the cmc to solve that ethan
Yeah I'm testing with 100ms ping, jumping, and then meleeing while in the air.
Does it correct you in the exact moment the anim executes?
Also doesn't the CMC support root motion stuff?
It's not the animation really. I'm not using root motion. I'm setting the character's velocity to lunge him towards the victim at 5000.f speed.
Oh that, yeah that corrects me too
haha
I do this when players ram each other
And the Server and Client apply it in different ticks
So they get corrected
Haven't really fixed that yet
I'm setting the velocity on the autonomous proxy only; I'm using ClientAuthorativePosition. And setting bIgnoreClientMovementErrorChecksAndCorrection to true. So it doesn't get corrected.
Yeah, but it will get corrected once you renable it
Cause the location is still different
Right, that's what I was seeing. So I'm sending the ending location from the client to the server
And setting the location on the server to that location
And then flipping bIgnoreClientMovementErrorChecksAndCorrection back to false
In theory your system should work fine with bIgnoreClientMovementErrorChecksAndCorrection always false. You might need a bit of redesign for that though
Yeah it works as always true, but I only want to have it true for the melee lunge.
Wait did you mean always true?
And updating the Server location doesn't resolve it?
No I mean never ignore corrections during the melee
Why would not ignoring work? Then I get corrections during the melee as well.
If you need it synced, you need to use a flag
Updating the server location looks to have make it occur a lot less. But it's still happening sometimes.
So instead of manually setting the velocity
If you design it like how the cmc's movement was built, you can have the client and server constantly on the same page
Or some acceleration
You need to add a flag for that
And set the flag
Then server and client will do it at the same time
We have a downwards push
It works the same as jumping in the end
It won't correct you
But you can't just apply force on each one, that will cause a correction in the end
Cause you will never get that synced
PressedMeele->SendFlag and SaveMove
Yea the saved move stuff is what I was thinking of
It's the closest you can get to emulating determinism in the cmc
That is what I started with. But it still was just lots of corrections because the server and client were lunging to different locations due to latency
That shouldn't happen though
The whole system is based on the idea that they do the same thing at the same time + ping
When the update comes in x ms later, the Client just replays the moves + the server move
And if you didn't do much wrong they end up at +- the same location
The SavedMoves + replay part is important
Hmm that isn't what I was seeing. So I wrote some lag compensation stuff that didn't work because of collision.
I guess I'll try going back to that
If it's only about apply a force/velocity change in direction X
Ethan if you look at lawbreakers their entire movement system (afaik) is implemented in the same style as the cmc saved move system
Then the flag does it
You just need to pass all required info
If the Direction and the strength of the attack are always the same
(e.g. 500 strength and actor forward) then it's fine to just pass the "PressedAttack" flag
If you have a player input direction (stick direction) and a player input strength (time button hold or so), you need to save/pass that too
E.g. a Jump has a hold time in the CMC and a fixed z Strength. That's why they pass and save the hold time
There is info on lawbreakers implemenations?
looking it up now
I wish there were more big open source games besides UT
I meant like look at the kind of movement abilities available to the player in that game. Not sure if there's any dev blogs etc, can't remember where I heard that they use the cmc system from
@thin stratus How do you pass the required info tho?
Most of my stuff is based on fixed values.
But usually you follow the way InputAcceleration is passed.
The strength is constant. But the direction is not at all. It depends on the victims location.
Which is why it was different on the client/server
But the victims location should be the same for both too
Or actually it shouldn't
Cause of the ping
Shot Behind Wall
Well the CallServerMove function gets an old an new move
The move contains the direction
So you gotta make a variable there
Right, ping was the issue. So I added a lag compensation solution. But it doesn't work in cases where the historical target location is behind the real character location on the server. Since they collide.
There should be a netQuantized normal for that
It's important that, if rounded etc., the Client uses the same rounded value!
Then in CallServerMove, it passes the stuff to ServerMoveDual, ServerMove and ServerMoveOld
Not sure if you can easily change that without your own Component
E.g. ```cpp
// Acceleration should match what we send to the server, plus any other restrictions the server also enforces (see MoveAutonomous).
InputAcceleration = NewMove->InputAcceleration.GetClampedToMaxSize(GetMaxInputAcceleration());
AnalogInputModifier = GetAnalogInputModifier(); // recompute since acceleration may have changed.
That happens to the input acceleration
Are you saying there is existing values on the move functions I can use? Or to create custom ones for them all and pass something else there?
I never extended the CMC. I made my own.
So I had/have free choice of parameters for ServerMove (ServerRPC)
The CMC might not provide that out of the box.
I also don't know what the CMC allows you to override
I think by default, the ServerMove function has, TimeStamp, InputAccel, ClientLocation ;MoveFlags and MovementMode.
I assume you'd need to pass the NetQuantizedNormal AttackDirection to the Server somehow (via the RPC)
So you might better off spending some time making a custom movement component
Even if that means copy pasting 90% of the CMC
But don't start with that until someone confirms
Yeah UT created their own move functions
For different reasons, but they did and it is quite a lot of code just for that
So it should be all overridable without a custom CMC
I guess VictimLocation might be better to send tho instead of AttackDirection
Hm except I keep moving towards the victim
On tick
Really depends. Idk what is cheaper.
So it's not just a singular location that I need to lunge towards. It tracks the player and keeps moving towards the victim until it gets close enough
// Perform the velocity based lunge
FVector DirectionToEnemy = MeleeEnemyLocation - MyLocation;
DirectionToEnemy.Normalize();
Velocity = DirectionToEnemy * MeleeSpeed;
I do that on tick while meleeing
WΓ€h
Also, may I introduce you to "GetSafeNormal()"
Saves you the additional Normalize line every time
π Thank you, that is a helpful tip
hey, is there a nice way to handle the host leaving a game ?
The GameInstance should have a OnNetworkError delegate
Despite that, everyone will time out at some point and return to the main menu
or whatever level they joined from
ok thx i'll look at that OnNetworkError π
It's kind of strange that CMC server moves were setup to only allow sending custom bools
Even if it passed a ustruct?
Anybody familiar with the process of setting up networking for a HTML5 UE4 game?
I guess it could be done by passing a struct that has a net serialize function that then calls another function that is virtual to let you serialize your custom move inputs manually
It's kind of strange that CMC <insert newest realization here>.
A good start to realizing the madness called CMC
I wish someone would do an entire udemy on CMC π
Well I do understand it to 80%
There is a lot of weird code with variable names longer than the HISMcomponent name that I don't get
Do you think subclassing all of the ServerMove, or whichever I actually need, and adding a parameter for EnemyLocation will work? Or would that only work for a single shot melee that doesn't keep following the enemy?
That or trying to figure out why my client authoritative implementation is still correcting are the options I am looking at right now.
You need a custom SavedMove class anyway
Here, look at this
That explains it a bit
Yeah I have a custom SavedMove and that is how I did my initial implementation
That wiki post as a dodge move
Maybe that helps
A convenient place to send the inputs is in the beginning of the OnMovementUpdated method.
Seems like that is a better place?
Not sure if that is actually a good idea
I still think you need to have a custom ServerMove function
Right, I was using that wiki when I wrote it
I used PerformMovement, but it is the same as OnMovementUpdated
The main problem of that wiki entry is (didn't see that before, sorry!) that they perform two RPCs
One is ServerMove
PerformMovement calls OnMovementUpdated
and one is the ServerSetMoveDirection
That won't work in my eyes
Cause that's not sync
Right, ServerSetMoveDirection looks like a bad implementation
You do have to pass it via the ServerMove function. I don't think you can get around that
I modeled mine after that and sent the enemy to melee like that
void UHoverMovementComponent::ServerMove_Implementation(float TimeStamp, FVector_NetQuantize10 InInputAcceleration, FQuat InControlQuat, FHoverInfo InHoverInfo, FVector_NetQuantize100 ClientLocation, uint8 MoveFlags, uint8 ClientMovementMode)
I'm sending all kinds of stuff
Currently not optimized though
It's so ugly to send melee specific stuff for all my moves lol
But I guess it's the way to go
It just feels wrong
The Enemy is on two different places on client and server though
So the Direction will be different
If you need one direction then either client gets corrected
Or client tells server the attack direction
Right, that makes sense. Yeah I sent the enemy itself. And was using my lag compensation stuff. But just sending the location would have been better. But still there is a race condition there between the separate rpc and the move
Correct
So a custom ServerMove is most likely required
Even though I'm pretty sure you grinning face is grinning a bit less thinking about making a custom movement comp :D
lmao
I can do it without a custom move component, like UT. It's just strange to clog all movement with melee specific stuff
what are you actually going to add to the move rpcs though?
I'm thinking enemy location
I would just add the direction
Which is the location the client is lunging towards
can the server not compute it too?
how would i only have users join a server session once everyone that is going to play the match is "ready"?
I assume the client doesn't see the same location as the server @fleet raven
The Local client might see a ghosting image
So you gotta trust the client here
It's the "I GOT SHOT BEHIND THE WALL" all over again
i'm using advanced sessions. the only way i can think of is have a master server which EVERYONE joins when searching for a match, doing the logic in there, then having them travel to another server when they are all "ready"
π€
That's called Matchmaking
once everyone that is going to play the match
Like a party?
Or just like "Press Play" and wait?
@median elbow
Did you keep all of these ServerMove functions with your custom movement component? There are so many of them
Yeah my movement comp is quite big again
I only stripped all of the root motion stuff
cpp is currently 3.3k lines
ok, so basically, they don't really have to click "ready", i will do that in code for them. but basically, i don't want someone to join a server all by himself, then wait for the entire server to fill up until theres enough people before the match starts
SavedMove stuff not in there cause I moved it into a different file
i would like them to see "searching for match", until there's enough people ready in a group to play a match
@median elbow Yeah that's matchmaking