#multiplayer
1 messages · Page 518 of 1
Yea, that sounds spicy. Haha
That's the approach which makes code testable
Implementing interfaces in C++ was giving me problems, looks like I'm gonna have to take another stab at it.
No I m doing the same thing and using interface to interact with no problem
I think I was just setting it up wrong tbh.
Check this out how I m using interface to do API call, and my API call is inside some viewmodel
My work is still incomplete
But few parts are working
Thanks! Will look into it. 🙂 Hard to find good references online.
Always love seeing how different people are coding. Haha
My design is inspired from MVVM pattern
(Had to google that.) That is very similar to the approach I have been taking lately.
Cool
Hello! Are there some best practices for replicating shooting? I'm not simulating balistics, so I just send hitposition to server which then validates whether there aren't any obstacles in the way. For broadcasting the shot to everyone, I'm currently torn between using RPC or replicated property. For multicast RPCs, I can't exclude the owner client, which needlessly consumes bandwidth (I already play all impact effects the moment the player shoots to avoid visible lag). However, with property replication, it will replicate each player's last shot to players who have just joined the game, even if the the shooting happened minutes ago.
what kind of a game @rotund sail
FPS, TPS, isometric camera?
TPS
how many bullets do you expect to fly around?
Well, there are SMGs, so I'm trying to be conscious about bandwidth
so not expecting people to be waist deep in bullet shells after 5 minutes?
The main focus will be PVE, so there will be situations where a player is shooting mobs, while no other players are around - which is a strike one for RPCs
Hopefully not! :D
you can't use a replicated property to nofity server of somethign
Oh I know, I'm mainly talking about replicating from server to other players
I use RPC to let the server know I shot at something already
Multicasts will check relevancy
(Sorry, should have clarified)
But the relevancy for multicasts is only distance to the source, isn't it? Or can you make a multicast that is not relevant to the owner client?
but with a replicated property its pretty awkward replicating the instant effect properly
well, you can solve both of those issues, but of course it needs additional info, which is not ideal
you can do an owner check
But the owner check is done only after receiving the multicast on the client
it is
Which means the RPC was already triggered and bandwidth used
you still need to inform the client that their shot was correct
so that you can correct if it was wrong
here is the most obvious problem with replicated property: its callbacks will execute when they don't need to, causing stuff like dead monster playing dying montage from OnRep_Dead to get up and play its dying montage when you run into relevancy range
I'm not too concerned about showing blood on the target's face even when the shot actually missed, honestly
Yeah, that's what I bums me out about using the properties :/
i do full simulation on my simulated proxies
they do get few things from the server (target/targetvector, firing mode, trigger pressed)
and then they guess the rest
my game is a isometric camera 8 man coop shooter that uses among other things, weapons like miniguns
so i can totally get away with it
i only do reduced damage in simulation to lower the chance of server having to correct any visible healthbar upwards
that's clever
Yeah, I thought about just replicating trigger pressed/released and having clients guess from the direction the gun is pointed... but that could lead to watching the player missing every shot, yet the mob falls dead
If it was pure PVE, I could get away with that, but there is PVP aspect too, even if not as prevalent
it depends a lot on how many players, how many bullets
but with PVP part you'll need to replicate them
either way
I just find it strange that you can set property replication to ignore owner, but not multicast RPC
strongly recommend giving the validations on server some room to fuck up tho
like validating line of sight by throwing a trace to target 30+ UU short of target and declaring it a success if you didn't hit anything
Oh I do validate it
point being: it will keep occasionally failing if you don't leave room for error
when it shouldn't
Currently, for the owner -> server, I have two RPCs, actually. One for missed shots - those have no validation, server just replicates them (because who cares). One for hits - then I send the pointer to the target actor, along with relative location
So I'm not telling the server "I've hit something at this point in the world" but rather "I've hit this mob/player in the head"
The only time the validation of that can fail is if the mob has moved behind an obstacle before the RPC arrived on the server
I actually have a quick question, I noticed when my client spawn an actor for itself (for visualization/menu purposes) that the localrole for the client is ROLE_Authority
this breaks all of the authority gates I have on whatever actor is getting spawned
is there a built-in way to just hard tell if someone is a client or not? Without it being relative to whatever spawned the object?
netmode
would it be (myactor::GetNetMode() == client)?
but it generally shouldn't matter if the locally spawned actor think it has authority
because it does
its not static
so myactor->GetNetMode()
The specific case is that it's a card game. Players have cards in their hand and on field, and the server spawns and manages these. You can, for example, search for a card in your deck and the selection option brings up cards, but only for you. Normally I have authority gates on any of the card movement logic because the cards moving is purely cosmetic (the server just does all the rules by looking at arrays)
so if I spawn a local "UI" card, the movement logic all gets turned off, because all the movement is gated behind role < authority
So yeah I guess I'll need to use GetNetMode
looks like that worked, thanks!
Is there a way to cancel steam lobby invite sent to players ?
I am using the InviteUserToLobby (https://partner.steamgames.com/doc/api/ISteamMatchmaking#InviteUserToLobby) to invite them, basically I have used the SendSessionInviteToFriends from the steam oss to send the invite.
If the API doesn't list a call, then no.
@thin stratus yup checked the API, there was nothing to cancel the invite. I was wondering if anyone has done anything related to cancelling the invite before, thanks for checking though...
There is no option in the Steam client to cancel an invite
If there's no API either it means it's simply not a thing
How can I make camera shakes not replicate? They play on both server and client without a replicated event
I'm pretty sure they don't, tbh
I just realised its not the camera shakes being replicated but its the function that they're in. Its supposed to only execute on the owning machine and not replicate to others
But it plays on everyone
After a little bit more inspection I found it's not replicating, a variable that should be unique for everyone is always same for everyone which causes the problem.
I thought camera shakes are being replicated but its something totally different
Nothing at a level lower than gameplay framework replicates at all, generally speaking
Meaning other than stuff like pawn, player controller, game mode...
Basic classes and engine feature never have any replication at all
Playing camera shakes is a client RPC
Unreliable, thankfully, but an RPC nonetheless. If you call it from the Server it'll cost a bit. Calling it locally client-side is fine though
UGameplayStatics::PlayWorldCameraShake() legit results in sending an RPC to all the players.
If you call that specific camera shake utility
This is a pure function that should return the state of the player with booleans, the problem is it returns the same values for everyone. How can I make this function unique to everyone?
Yeah depends what you're using to play the shake
That won't unique. I imagine there's something wrong with your logic elsewhere.
I'm not sure where the problem is, I tested the function by itself and it works correctly, unique for everyone. But when I use it inside another function it returns the same values for everyone. I have no clue
Solved it! Idk why this works honeslty
I'm trying to setup the Steam subsystem, in the logs I can see that it returns sessions when I use the "Find Sessions" node in BP, but they're all from different projects, I'm using the default 480 app id.
What project configuration am I missing?
if i want to spawn an actor for only a single client can they just call spawnactor locally?
@rocky totem maybe you need to do a RPC to the server and then make other RPC to own client
====
hey guys...i'm trying to do a multiplayer action combat system
I'm getting my targets doing a trace that run on server after called on anim notify state in client side
sometimes I notice that miss some hits....the animation is playing but don't do damage or getting the target
whats the better way to do this?
all RPC that involve damage and getting targets already checked as reliable
Can somebody give me advice on developing a multiplayer game on UE4? I've seen tutorials on using steam and using source code. These appear really complicated. Is there an easier way to host a game? Can discord host a game I've developed since it has server capabilities? I'm not seeing hardly any tutorials on integration using UE4 with discord?
Some basic answers : Discord doesn't host games, Steam doesn't host games, and you probably don't want to host games
If you're doing a multiplayer game, do a simple one that's not competitive (PVP) and use listen servers
No source code required
yes you can spawn a local actor @rocky totem
if you want to have your own private appid @twin juniper ... well, you have to buy your own appid lol
it's giving you games using appid 480 
you've never done multiplayer have you 😄
admit it!
steam expects more info, like a project name, and with that it would return the right servers to me
What appid does shooter game use anyways? I've seen its not 480
Thanks Stranger! My plan was to do a simple multiplayer third person shooter with 2-3 players just with friends on different computers. Either I would host the game and they would join or with game copies they could host the game and play among themselves. Yet, everything I'm seeing appears to limit the hosting to myself. Do you have any recommendations of any good tutorials that would allow simple server set up as you suggest?
Look up listen servers in UE4
No separate server at all, just one player acting as host
Thanks! I'll check it out
how can I identify two different actors with the same class in a multiplayer game
I'm spawning these actors and I'm using the player ID to associate an owner
the problem is inside the actor I want to run different logic base on which client spawn it
initially I was going to do an authority check but this has to run on a dedicated server
With the exception of a vague brief UE4 documentation page, I'm not having much luck finding tutorials on listen servers. Everything is focused on steam dedicated servers. There are plenty of tutorials telling how to setup projects for steam servers, but they don't show how they work with steam when completed. I have a bunch of noob questions like, do I upload my game to steam and people access it there? Or do people access my game through my computer? If they are accessing my computer through steam what's the point of steam? Do I need to buy server hardware to host a game if its through my computer? If I'm the server, can my friends access the server when I'm not there?
steam allows people to download your game
More questions... What is this whole steam ID thing? Is this limited to people who want to sell games? What if I want to just use steam to host a free game for a few friends? What are the requirements for getting the steam ID?
and steam allows your players to advertise their games to each other
someone will still need to host the server
if you host a server on your computer it has to be on to keep working
steam id is a number you get from steam when you pay them to put your game on their store
if you just want to play a game with some friends you don't need steam at all
using the steam infrastructure is limited to people that want to sell games yes
full steam documentation can be found here: https://partner.steamgames.com/doc/gettingstarted
but you likely don't need it
Thanks Thexa you answered many of my questions! What do you recommend besides steam if I'm not planning on selling?
use the null subsystem and connect to each other directly by ip
so basically use the defaults
do you have any tutorials you'd recommend that deal with this
I mainly have experience with steam, not so much with unreal, sorry
no problem, thanks for your help!
good luck!
Guys, having a bit of an issue replicating a variable, its a simple INT inside the character class that get incremented when the player lands a projectile hit
before spawning the projectile there is a owner var that is set, so i spawn the bullet inside the character with an RPC and i set the bullet owner like, owner-this;
cant do the arrow cause my keyboard is dumb
it works the first time the player is hit and it stops working after i change its value
debuging tells me that the server and the other clients still think the varaible holds the same value before i changed it localy
but i set it to replicate properly
Are you trying to set a variable in a client and have the server know the value? Variable replication only goes from server to clients, never the opposite. RPCs are the only route to move data "uphill" to the server
ye thats what i figured with a little test that i just did
i thought they went both ways
is there anyways i can make the server change it without having to call an rpc, i mean its a bit annoying to make a method just to var=0;
when first getting into designing online multiplayer games is it better to stick with blue prints or do I need to start learning how to code c++? Blue prints seem easier and have more tutorials whereas I'm struggling to find much in the way of C++ in UE tutorials.
I'm gonna lose my mind. Does anyone know how to replicate root motion?
I've tried with the anim blueprint
I'm trying to test out server joining with a packaged game but whenever I launch my dedicated server from the editor and try to join from the packaged game it can't find the server. when I get on the client that launches in the editor it finds the server as expected. any ideas why this is happening?
@hoary sandal Calculate whatever ID you want it to have on the server and set it from there.
I should probably note that when trying to directly join using the dedicated server's IP and port, it throws a PendingConnectionFailure
Same machine or 2 different machiens?
same machine
What are you joining, Lan IP, Wan IP, 127.0.0.1, or localhost?
I believe Lan or Wan IP
Those 2 are different.
I'm asking are you trying to join a 192.168.X.X IP or your public external IP?
hmm
Try these scripts, can you start and join this way? Doesn't fire up the editor, just launches game standalones.
You gotta edit for your version and uproject file.
I'll try
well the server showed up and I could join
although when I joined the game it didn't seem to load the map properly so I'll have to take a look into that
thank you!
nvm I forgot to change the map name
I can't seem to join from a packaged game still
only from the editor or if I run the .bat you gave me
ah I found the issue
if a client with steam enabled tries to join, they get immediately kicked from the server
Hi all, any idea is ACharacter::Crouch network replicated?
@median marten yea it is replicated
hi guys running into an issue spawning a component https://gyazo.com/95e0c749b4b03734297c0cf27bdfe241
the mesh is invisible the collision is there and everything is updating
when I try actor instead everything works just fine
@frank portal Thanks!
TreesStaticMesh = NewObject<UStaticMeshComponent>(this, UStaticMeshComponent::StaticClass());Will it be created everywhere if I create an object on the server?
Or I will need to re-create on the client
@dark edge as far as I know the ID lives on the player state, you mean that I should get it and pass that as an integer to the player character?
@hoary sandal I mean whatever way you're calling them Thing1 and Thing2, just make it a replicated variable on the actor and let the server set it
Hi! I could need some assistance in getting projectiles replicated from client -> client/Server. Server -> Client works.
My Code: https://pastebin.com/6MHv28rw
Do I need to have Reliable Server Functions for LineTraceFire() and ProjectileFire() ?
void AWeaponMaster::ServerLineTraceFire_Implementation()
{
LineTraceFire();
}
bool AWeaponMaster::ServerLineTraceFire_Validate()
{
return true;
}
void AWeaponMaster::ServerProjectileFire_Implementation()
{
ProjectileFire();
}
bool AWeaponMaster::ServerProjectileFire_Validate()
{
return true;
}
void AWeaponMaster::ProjectileFire()
{
if (GetLocalRole() < ROLE_Authority)
{
ServerProjectileFire();
}
if (ProjectileClass != NULL)
{
FVector MFloc = WeaponMesh->GetSocketLocation("MF");
FRotator MFRot = WeaponMesh->GetSocketRotation("MF");
FActorSpawnParameters SpawnParams;
SpawnParams.Owner = this;
SpawnParams.Instigator = GetInstigator();
AProjectileMaster* const Projectile = GetWorld()->SpawnActor<AProjectileMaster>(ProjectileClass, MFloc, MFRot, SpawnParams);
WeaponData.CurrentAmmo -= WeaponData.ShotCost;
LastFireTime = GetWorld()->TimeSeconds;
}
}
or am I doing something wrong now?
Well at the moment if you call ProjectileFire() on the client, both the client and the Server will spawn projectiles
hmm
Probably want this:
{
if (ProjectileClass)
{
if (GetLocalRole() < ROLE_Authority)
{
ServerProjectileFire();
}
else
{
DoFiringStuff
}
}
}```
Have a look at the ShooterGame weapons
Bit outdated but same principle
Thanks! I will look at the ShooterGame Example. One question though
in my Projectile Class I'm trying to add this with #include "Net/UnrealNetwork.h" in the header-file: ```
void AProjectileMaster::GetLifetimeReplicatedProps(TArray< FLifetimeProperty >& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME(AProjectileMaster, ProjectileMesh);
DOREPLIFETIME(AProjectileMaster, ProjectileMovement);
}
I'm getting error: Member function not declared
why?
I suspect you need to declare GetLifetimeReplicatedProps() in the header
Also move that include and code to the CPP not the header
I didn't need to declare it in Character or Weapon class :/
First things first, move it to cpp
that's done
Make sure ProjectileMesh & ProjectileMovement are UPROPERTY(Replicated)
And IIRC, rep notify don't trigger the declaration of GetLifetimeReplicatedProps(), so you need one regular Replicated UPROPERTY
Or declare it yourself
Aha, okey 🙂
^Rep notify does triggger it at least in 4.24
Ah, that's nice
Used to be that it didn't and you needed at least one regular Replicated in the class or parent
Hey guys...i'm trying to do a multiplayer action combat system
I'm getting my targets doing a trace that run on server after called on anim notify state in client side
sometimes I notice that miss some hits....the animation is playing but don't do damage or getting the target
whats the better way to do this?
all RPC that involve damage and getting targets already checked as reliable
Does anybody know where the default properties are set for UNetDriver?
Things like NetServerMaxTickRate and bClampListenServerTickRate etc.?
Can't seem to find where the defaults are kept
Oh wait, nvm
so is that "add client" button in PIE supposed to work?
it just crashes the editor whenever I use it
did the same in 4.23
There's a button for that? I had no idea
it appeared in 4.23 but as far as I know it never actually worked
i did see it working
but never used it myself
it was a very basic networking project, on TPS template tho
it was 4.23
hi
since i can't ask every player to change his port to 7777 on my listen server game
can i "port forward" their routers using c++
Only the host has to do it.
If you really wanted you might be able to implement upnp into unreal but many people who know what upnp is really don't like it affecting their network devices
is there a simple way (other than epicleaderboard) to create an online leaderboard that is multiplatform? or if the only way is complex does anyone have a way to do it (ie documentation or tutorial). Ive looked around for a while and the only one i can find is epicleaderboard but it is abandoned and doesnt have features i need
@hoary lark more informations about the upnp method please
whats wrong with using steam?
its socket connection will do NAT punchtrough automatically
but in any case - to avoid port forwarding you do need at least one publicly exposed server to make introductions
Ue4 can do a fast and smoth multiplayer gameplay like this:
https://youtu.be/VRxfjfmyQL0
???
過去コンボのプチまとめ動画です。4の速さは気持ちいいですけど、5の選択肢の豊富さもいいですね。
Used BGM
1.DMC3 Devils Never Cry
2.DMC5 - Devil Trigger (Shall Never Surrender Mix by Hikouma)→https://www.youtube.com/watch?v=QMzer...
Guys how i can find more info about UE4.21 "DDoS Detection and Mitigation"?
@ivory lintel UE4 can do anything if you want it too
I am trying to do a multiplayer action combat and dont like replication results
You'll probably want your own movement replication entirely for something that's not a FPS/TPS type game
@bronze arch proper ddos mitigation is usually at the hardware level, not so much directly in your application.
you would do that in the firewall normally
Standard movement component is for fps or tps only?
i know but i want to also use that for UE4
@ivory lintel It's a general purpose movement system, primarily used in Fortnite (now) and in Paragon, and UT (before)
why? software attempts at preventing ddos attacks will be inferior and honestly unneccessary
if your game will be hosted on professional servers, they will also be behind hardware firewalls which are incredibly powerful.
@ivory lintel It's a good option for games where characters are walking, which is a lot of games. If you need something very fast-paced with a lot of ability-based actions, it's not really ready for use as is
You can try doing changes to it etc
to be honest, having your application attempt to handle a ddos attack is probably going to only make it worse lol. having a firewall solution simply denies the traffic all together.
I want to do a combat like warframe or devil my cry
In multiplayer...just a simple 1x1 its good
i see, thanks then i'll leave that option
There is nothing simple about multiplayer, ever. 1v1 isn't much simpler than 10v10
You'll need some work
Movement is half of a good game
movement is the less trouble thing
You can look at Anthem for a game that spent something like 50 man-years working on movement alone
hope its not the whole skeleton
All things working fine. Works with AI and 1x1 or similar
Have frontal block
Stats like HP, MP a and SP
Dashes etc
Do YouTube can see a short video To help me improve the system?
Do you*
So Rep Graph is... interesting.
https://www.youtube.com/watch?v=ggnSFNJaH4Y
Not only does it seem to completely bypass the Max Rate setting (hits like 24Kbps), it also seems to handle saturation a lot better.
That said, I'm sure the legacy net driver used to be able to handle higher spawn rates. Maybe it's a bug in 4.24
the replication graph example code is really bad
That's just the shootergame one
yeah
But either way I didn't expect the difference between the legacy driver and the rep graph driver to be so stark
As in how it handles saturation etc.
It's the editor environment so take it with a pinch of salt, but Rep Graph seems a lot more resilient
ok? why? what does that do? how is this useful example code?
Hah yeah, I found out why that is in a 3rd-party video
Apparently Rep Graph doesn't like it when you create a very large rep-list on the fly. Not really explained though..
and what's with the seemingly random numbers?
Hell knows
I'm trying to package a project but I keep getting this error and the package fails. What is causing this?
UATHelper: Packaging (Windows (32-bit)): ERROR: System.IO.FileLoadException: Could not load file or assembly 'file:///C:\Users\Owner\Documents\Unreal Projects\MultiDemoBackUp1\MultiplayerTemplate 4.21\Intermediate\Build\BuildRules\MultiDemoBackUp1ModuleRules.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
Ladies and gentlemens, im stucked about that much bytes send from UE4 replicated movement system. Guess i missed optimization about that?
Server side AI actor makes 17461 bytes from replicatedmovement component
thats so much bytes than RPC's.
Need your help. thanks!
also was 20frame net update while profiling this (Imagine 100netfreq with this bytes
)
that seems about right
Really o.O why so much bytes for just location and rotation vector3
how many AI?
4
netfruency?
20*
yeah its 20
net priority should be 1
but then sometime attack rpcs doesnt work
yes RPC's are sent and processed seperatly
the replication of the actual actor, and its properties is those values above
so whats work with net priority? is for movement?
no net priority is how often that actual actor will replicate
ah yeah you also mean replicated variables
Net update frequency does affect unreliable multicasts. But no other rpcs
^ i remember that now, thanks for jogging my memory
np 🙂
so thats why it doesnt work multicast attacks when i set priority 1
just using ai move to
struct FRepMovement ReplicatedMovement;```
this is what is costing you
probably around 40bytes tho per Actor per Replication
but your values is the combined
not the single value
1016 times
that property replicated
and that value is the total
which is 17 bytes
per property
compressed
which is good, so what is the problem?
i thought maybe there some more compression or optimization for that
nope
its already compressed
and optimized
FRepMovement contains quite a bit
LinearVelocity, AngularVelocity, Location, Rotation, plus some enums. so 17bytes is pretty good
what you could do if your not worried about precision
adjust these
but if things break, don't blame me 😄
i see, but i saw some setting on here "save bandwith"
thought maybe i can save some bandwith, well
i mean your issue is not that
you highlighted a single property
as being super high
we have 100 ai
it was already whole number
and we didn't change anything, and have 0 issues
bandwidth is good aswell
think you are over thinking it
and over optimizing for no reason
okay im calming down, sorry :D was overreacted for that
im also learned some infos about that. Thanks mate
np
once you have the game in a good working state
i would then profile your net performance
and see 🙂
you use some database @meager spade?
no, not yet at least
Has anyone tried Live Coding with C++ Multiplayer? Everytime I compile it seems that it doesn't get the latest changes :/
I'm on 4.24
If anyone knows of a way to create the classic "Mirror light reflection puzzle" in multiplayer please let me know. I can't seem to get the light to replicate correctly. When the light reflects it sometimes isnt synced up over the network. https://i.gyazo.com/8aadf20034948fb475f949a0e2dc69b3.jpg
i'm using linetraces but I can't get the replication perfect for when it reflects. It seems to be off by a little bit as you can see in my picture above.
@cedar finch You need to double check the geometry of the reflectors and the trace vectors
Or just do the tracing on the server and send results to clients
I'd start by printing the rotation of the reflectors and all the trace directions and looking for inconsistencies.
If I program the server side for "spawn projectile" and in the player controller i use "spawn projectile multicast" will it work? trying but not working still trying to understand server-client diagram
Try a Run on server with a switch has autority in The Two Bluprint (Player controller and The other)
do you have a recommendation what other blueprint should be? @desert glacier
can i use both sides in the controller?
what i am doing wrong?
OK, So just the player controller
@twin juniper
- Multicast on PlayerController makes no sense, it only exists on a maximum of two entities, Server and OwningClient.
- Replicated Actors should only be spawned from the Server.
and i was downloading your compendium 5 minutes ago just because im stuck on that lol
- Try to never use GetPlayerController or GetPlayerCharacter unless you are 100% sure that you are referencing the correct controller/char. You should otherwise always get the controller/char from the current actor, given it supports it.
E.g. if you are inside of the Character, on the Server, and you want the controller of that character, you use GetController. If you'd use GetPlayerController0, you would end up with the server's PC, which is wrong.
I understand, is that why virtual joystick always controls the server?
Keyboard input replicates but not virtual joystick
If you are referencing the controller via GetPlayerController, then that could cause this,yes
If you are already in the PC just use "self"
That references the instance of the object you are currently in
I understand now, thanks a lot
@thin stratus your ue4 networking pdf document helped me a lot
i recommend it for everyone
Glad it helps (:
i read your compendium, finished the RPCs and ownership and still confused about what should i use for my movement input @thin stratus (sorry if i disturbing you by adding @ )
virtual joystick is only activated by project settings, and using server side to execute and using client replication to send it to server
What are you even controlling with these
those guys, pawns
If they are characters then it's enough to just call AddMovementInput.
The CharacterMovementComponent deals with replication of input
it is already, still not working and also other one is "set control rotation" and its not working too
Does FTransform_NetQuantize strip scale?
never heard of FTransform_NetQuantize
ah you are right, sorry that's our own custom type 😆
Is the standard way to quantize a rotation to use FVector_NetQuantize?
if you don't need roll
FVector_NetQuantizeNormal would do
you can't restore roll from FVector
Thank you Zlo 🙂
{
switch (QuantizationLevel)
{
case ERotatorQuantization::ByteComponents:
Rotator.SerializeCompressed(Ar);
break;
case ERotatorQuantization::ShortComponents:
Rotator.SerializeCompressedShort(Ar);
break;
}
}```
if you are packing inside a struct
looking to cmc, Zlo was right FVector_NetQuantizeNormal CompressedRotation(Rotation.Pitch / 180.f, Rotation.Yaw / 180.f, Rotation.Roll / 180.f); @jolly siren
Awesome, thanks guys 🙂
@mental timber Keeping the convo going, you can get away with a surprising amount of spawning in MP
https://www.youtube.com/watch?v=ggnSFNJaH4Y
Even if you decide to use projectiles, using bNetTemporary and/or NetUpdateFrequency of 1.f I could spawn like 300 of the things without going above the default 10Kbps limit
Crappy test setup but you see the point
Yeah. One of my main goals was to get away from projectiles as much as I could. But I couldn't get the behavior I wanted, so I resorted to keeping them until Adriel showed me otherwise.
I didn't want to transmit so much data for every position update. So this new system is an awesome step in the right direction
Yeah you don't need too for sure. I use Dormancy pretty heavily on my projectiles.
They only send an update when I explicitly tell them too, i.e. when first launched, when they bounce off of something or when they die etc.
You can get quite a lot out of them, the biggest cost difference at that point between using actors vs a data-method comes from having all those different actor channels open, checking for rep etc.
Data method is great if you want to go mental on reducing overhead, but bit harder to get flexibility. Not an issue if 95% of the game is regular ol' bullets though.
@mental timber You should always strive to only replicate the bare minimum amount of state needed to recreate the world. For example, my game has modular vehicles with arbitrary configurations, tons of parts, and is entirely physics driven. The only replicated state is the physics state of vehicle chassis, and the control variables (Throttle, Steering, Aim, etc.). If i tried to replicate the state of everything it'd be huge, but it's only 2kBps doing it this way.
So if your bullets are fairly predictable, just replicate their start position and initial velocity values. Everything else should be derivable from that.
My goal was to have bullet mechanics that could hit something if it were to move in their way after the trigger was pulled. So, in flight, their path is interrupted.
If I can do that, then I'll be successful.
You need bullet drop or no?
Yeah. I'm aiming for a realistic feel and trajectory.
K. I'd ignore drag unless you're going for reaaaaaally long shots, as it'll mess with the math.
And eventually I'd like to affect position with wind, too. But that's a bonus after all other features are done
but do the approach I showed, but use a Verlet integrator as it'll be more predictable.
@mental timber
X is are your positions, A is gravity + wind. Velocity is derived, not calculated. Sec, I'll whip up a gin
gun
I'll whip you up a gun, sec
Yeah vector math is the name of the game for gamedev, learn it
4.23
best update lol
Yeah, i have it installed. Just not using it for my current project
And haven't bothered to update it
Probably should
oh if its installed you can look at this BP im making then
For sure
how do people solve this?
what's happening there
so if i spam the quick bar
ie cycle weapons rapidly
with high ping, then it changes the weapon once the server runs it
see it better here
its equipped locally,
I solved it by making the equipped weapon part of the state that I predict/reconcile atomically
no idea how others solve it
yeah but i think its the attachment
as nothing else is replicated
to owning client
isn't there some way to disable that?
not sure, i mean i dont need to attach on server
i can just have simulated attach it themselves
shouldnt cause any issues, as i dont fire anything from the weapon server side, and nor do i run animations server side
so the weapon doesn't need to be attached oh wait, relevancy
ffs
dang
Anyone know how roll the player camera in blueprint? I'd imagine I only want to do this client side, as it's just visual feedback for the player.
I'm basically rotating the camera to indicate the player is wall running, and I was able to get it working without pawn control rotation, but this led to slower/laggier general movement.
Or if there's potentially a way to just not have the roll of the camera replicate.
@dark edge index? :p
lul
I’m working with a dedicated server and the advanced sessions plugin, is it possible to join another session within the dedicated server and load into that session.
Has anyone run into issues where, when using the advanced sessions plugin, "Play with new process" loads steam just fine...
Yet in a compiled build, it does not load steam?
anyone knows how i can change each player's health bar's color based on whether they are an ally or enemy ?
@tawny crest First you need a way to tag them as ally or enemy
i gave them a team tag on spawn
ive been messing around but it seems that the server is the only one that actually changes the enemy/ally's health bar color
Who owns the bars? They a widget on the character?
widget component on the character
Is there a difference between (Run on owning client) and UFUNCTION(Client)? I'm just starting to learn c++ and im not getting the same result
UFUNCTION(Client) is the c++ version of Run on Owning Client, yes
I'm trying to set render depth on an actor when player overlaps its collision. In blueprint i just set it on a simple run on owning client and it only happens on one client but in C++ it is still happening on all clients.
UFUNCTION(Client, unreliable)
void SetRenderDepth();
void ABasePickup::SetRenderDepth_Implementation()
{
SkeletalMesh->SetRenderCustomDepth(true);
}
Is this an ownership issue? This function is being called when a component overlaps its collision. So I guess technically its being called by the server? Do I need to pass a ref of the pickup to the overlapping component and call the function from there somehow?
The overlap event will be triggered on the server and clients
So it sounds like you are just calling the client rpc directly on all clients
Why do you need an rpc for this?
I only want it to trigger on the client that overlapped the collision
Then check to see if the character is locally controlled
You dont need an rpc. And the server doesn't need to be involved. Unless you need extra security.
Maybe I will have to play around some more but I wasn't able to get it working without rpc either. always enables it on all clients
I really appreciate you taking the time to reply thank you
Right you need to add a check that only runs your code for autonomous proxies.
Like this ?
if (Role == ROLE_AutonomousProxy)
{
SkeletalMesh->SetRenderCustomDepth(true);
}
oh wait role of the overlapped comp?
Ayyyy. Got it working. Thank you so much.
Interesting. I just realized I had a "Is Locally Controlled" node in my blueprint. ROLE_AutonomousProxy is the equiv?
Hey guys. I'm still working on replicating my laser mirror puzzle. It seems that when the laser hits a mirror the calculations from then onward are slightly off which means the more reflections, the more off the angle is. What I do is take the impact point of the first line trace and set that as the "cast Origin" then I set the "Cast Direction" by getting the Impact Normal and using "Mirror Vector By normal." How can I replicate this so those two variables will be the same for all clients?
https://i.gyazo.com/4200080673ca640478d2e263307b87ee.jpg
https://i.gyazo.com/425bd553cc82b747c8cdeec4e698f1f5.png
https://i.gyazo.com/c661eacbf814fc5d55e95fcd1bdbd875.png
https://i.gyazo.com/685f3be9028d43b9c75f6232512e148f.png
https://i.gyazo.com/214b40f02cabdc8fed7e3a04df5a62bc.png
working a bit on extending the character movement component and am confused a bit on some things.
game is an fps/rpg type of thing with spell casting. some spells are movement abilities like blink or a superjump, or modifying a movement speed variable. my spell casting event flow is that the client initiates a spell cast, it is checked, client prediction is performed, and then the server rechecks and performs the server version. for stuff like damaging spells, this is simple as the client just predicts particle effects or hit markers, while the server implements the actual damage. for movement, i want to use the SavedMoves that the CMC uses, but I'm unsure how to predict the movement and then make sure that the server verifies the actual spell cast went through to perform the movement. do i need to pass a SpellCastID as part of the SavedMove? what happens when the move arrives before the spell cast RPC? anyone have any ideas?
@cedar finch Do the tracing on the server, replicate out the beam segment end locations and use that for drawing
That's what I thought but it's run on tick so how can I do it without destroying the network?
Just make 2 replicated arrays of vectors. I'm pretty sure they'll only replicate out when they are changed. So only when things are turning
Or you can find where the imprecision is coming from and do some rounding to keep it from magnifying.
Does Shooter Game have any form of rewind when it comes to validating player hits?
Hey guys, what's the best way to verify if replication of the entire map and its actors has completed? For now the players have to stay frozen until this completes, but id like to display a loading screen during this
I'm looking for some event I can bind to or maybe a function I can override
On each client, check on tick that all replicated vars have valid values, and then tell the server with a RPC
Hmm, that's going to be a bothersome solution because there are quite a lot of replicated vars.
That's what you got
Is there not some kind of event when the level and its actors have replicated for the first time to the client?
Replication is not atomic, so there is no one event for an entire actor
Individual variables might replicate at different rates
What is exactly causing players to stand in place for a while before they can play? Does it wait for all variables on the client to be replicated first?
As in the character
Does anybody know if FFastArraySerializerItem can have a NetSerialize() function?
I would assume it does... but asking just in case
Turns out ya can. Lovely
Why do we need "run on client owner only" rpc instead of not replicating it?
That's a weird question
Client RPCs are server->client function calls
No replication would be not doing anything at all
I understand
It will happen in client but data never will be sent to server and it will stay as a visual thing only, right?
Client RPCs are to be used when you need the server to call a method on the client
So the server calls it
Calling a client RPC from the client makes no sense
thanks
Hello guys i have this method idk what is wrong when im hiting the actor both server and Client getting dmg
i've tried to replicate Current Health samething
does anyone know how to set up a module/class for dealing with a backend sql server, and if so could you point me in the direction of some up to date resources, thanks
@rigid zinc it depends.you want the GameClient connect to sql server directly ? its not appropriate though. u need something like master server.
i followed this:
https://www.youtube.com/watch?v=xuCINI2sPKc
Download links :
Project
Ver 4.22
https://drive.google.com/file/d/1lZwNJ3xEMI11gE1BQOypZQCsg_AGDbiN/view?usp=sharing
It's a little different on how i spawn things but it's essentially the same
Ver 4.18
https://drive.google.com/file/d/1Fiuqta3sra-3rRJBEDXteOqcWGDeWSXd/view?u...
thanks
Anybody finding that the PacketSimulationSettings don't work at all in 4.24?
bah NVM, clumsy seems to work way better
clumsy?
Hey, is there any case of replication degredation since 4.24? Everything was fine for me on 23...but since the update the replication esp the initial one(dedicated server) takes a long time. I am going to play with Insights today, so any pointers where to look or if somebody dealt with this before would be welcome 🙂
@turbid tree Are you using blueprints?
mostly yes
nothing touching replication in c++(yet)
I am more than happy to go into the debugging myself, I enjoy a bit of network torture 🙂 just curious if anybody had the same issue ... already testing if some of my "bad" network state stuff is not persistent or enabled by accident..and no luck there so far I blame something in the engine that probably was deprecated and I was using it 😄
The project started at 4.14 and got upgraded every time there was a newer version of the engine
I had problems with delays and lag after upgrading from v.23 to v.24. Never really figured it out, but added all the replication nodes again, and it worked normally. Trying to stick to c ++ now. ;)
i'd never consider blueprint networking
its very restrictive, you don't have any optimization tools, its verbose and the OnRep is clunky
It works fine as far as I know.. obviously once I move out or prototype I will need to go c++ but for what I am doing now it is fine
no custom serialization, no structs in any usable form
@sand tangle What do you mean by "added all the replication nodes again" like all the custom events recreated and such?
I would rather not go that route 😄
(set a RepNotify variable locally on client in BP, and watch the OnRep fire on that client)
@winged badger I am all for doing networking in c++ but I sort of need to iterate stuff now and BPs are just... well faster in that sense 😄
but it is down the line 🙂
that is just a matter of practice 🙂
nope that is just matter of compilation 🙂
takes 20 seconds for live coding to compile, not too bad
try that on Linux 😄
found your problem
😄
but the difference is when you get stuck on a replication race or some such
Tested on Windows as well same issue
c++ becomes very much faster then
I am not arguing your point 🙂
I agree with you 😄 .. just saying that at this point in time the breaking point was the upgrade from 4.23... and I want to figure out what why and how 🙂
So no help here... Insights it is 🙂
doing the 4.22->4.24 soon
(sorry that came out saltier than I ment it :D)
Something happend to replication in 4.24, with blueprint. Yes, I did recreate most of the custom events and such, to make it work again. Only using blueprints for animation now. C++ is more cleaner, easier to read, faster ++.
🙂 I will try that if I cannot figure it out using Insights... my only pointer right now is
LogNetPlayerMovement: Warning: CreateSavedMove: Hit limit of 96 saved moves (timing out or very bad ping?)
very bad ping on localhost is fun 🙂
Was that at least for me?:D
I can still check 😄
No sorry I had another question
yeah figured 🙂
If you are spawning an actor like a PlayerState (a replicated actor that holds data but isn't visible in the world but is still attached to the player), am I free to just spawn it the same way the controller spawns the PlayerState, but then not bother attaching it to the pawn (as in this case it's just reading some simple data from the pawn) and let it just sit at the origin?
In this case it is a system like the ultimate ability system in Overwatch. The derived classes each have a unique ability which spawn other replicated projectiles actors etc. but the ability logic itself (ability name / cooldown / icon etc.) is purely data only and doesn't need a visual representation in the world
I thought it would be better to have a separate generic ability class rather than cluttering up the character
But the problem with separating it out is that it still needs to be spawned in the world if it is to replicate properly, so that brings the question of attaching or just letting it sit at the origin
playfab
is the only way to increase RPC per netupdate via a cvar?
as far as i know
It always says "accessed none" about branch, what should i use instead of these references?
it says server side.. but you are multicasting @twin juniper 
I know
I think there are some conceptual flaws going on there
First time i was learning i misunderstood replication then i decided to name it like that lol
what do you want to do?
I made a collision box to player
When an enemy collide that box
Player must turn to enemy
okay so why are you setting this onrep variable on a multicast?
your references don't exist in the context within you are calling them
that's why it fails to get them
because they are not valid
you shouldn't replicate to server the event tick
mainly because tick fires in the server and in the owning client in this case
so what you are doing there with that server rpc is wrong
what should i do?
so... it depends on how you want to lay out your logic
but most importantly you need to understand replication contexts
basically you want to rotate your controller towards an enemy location, right?
yes
or something similar to that, okay. So if you go step by step
you need to ask yourself
does my cube exist in the server?
yes/no
if it does, I can use the cube reference in the server
however since we know event tick fires in both server and owning client
we would need to constraint only to authority
reminder: onreps are like multicasts
you set them on the server and they execute on the clients
however they are even better than multicasts
they execute as soon as the variable gets to replicate
which is convenient to avoid any kind of data race
so you should ask to yourself these questions
specially about context
"does this thing exists in this context"
"if so, let's use it, and let's see how I can carry on references along the network"
a replicated variable is the same, you set it on the server
it will eventually replicate to the clients
but you don't know when
with onreps you can know when the variable replicated
it's the shame of blueprints
once you get networking contexts everything will be much easier, at least for you as developer
but it is crutial for you to understand it
they tell what is client and server side and examples of replication but i couldnt find a way to replicate some specific things
such as?
this one
i only found changing materials and meshes for replication, also read compendium that exi's
this one is another use case, a generic one it looks to me.
yes compendium is a great reference
he explains there how to replicate variables
and contexts
maybe you missed something important?
yes could be
now, let's try to tackle your problem
try to apply what I told you about server shenanigans
check where the cube exists
you're asking if its replicated or not by existing, right?
the cube is an object in the world, right?
Yes
where do you get the cube reference?
but the variable will be empty if you don't fill it with anything
you need to tell the variable what it is pointing at
a variable is just a container
of a type
if the container is empty then there is no fun
you need to put into your container the real world actor
how?
by "set" ?
exactly
now, how do you get it?
querying to it
you can query an object in numerous ways
cast or get all actors of class maybe?
through a hitscan, direct referencing, all actors of class... ect.
be careful with all actors of class, don't use that too much it is a bit expensive
okay @pallid mesa , you really helped me, thanks a lot
any time :)
I preffer you to wrap your head around it
instead of giving you the easy way
that way you can learn better all the concepts
i'll read the compendium again
take a look at the variable replication section
I don't know if eXi cover worlds in his compendium
he might but I am not sure. Either way that shouldn't affect you too much
okay, thanks again 🙂
We are building a card game to accompany our main game but we are having the card game be multiplayer. Can a single dedicated server handle multiple sessions of 2 players?
or does each match have to have its own dedicated server instance?
because the latter is crazy sounding in logistics
Each match has it's own server instance
But you run multiple instances on the same machine
The only alternative is to create a meta system specific to your game, where many players join the same server instance and the game mode sorts them into pairs
Technically speaking however, those players will all be in the same match as far as the engine is concerned.
There is little reason to use dedicated servers for a card game, to be fair
You can make the game fully client authoritative, and have each client report the game log to your own server if you want to investigate cheats
OSS is fine for matchmaking etc
Dedicated server is what you don't need. Biggest drawback is, no exiting mid-game and other player(s) keep playing
Which should be fine for a card game
Yeah dedi for a card game does seem like overkill
If Splatoon doesn't have dedicated servers, your game probably doesn't need them 😬
Unless you expect a ridiculous influx of players (I hate to break it to you, but don't) - I wouldn't bother unless you know you need that kind of support
okay so then i would need to tie to steam or google play or something to handle central control for match making.
so clients can find each other.
The most convenient for your users is indeed to use that platform's OSS for matchmaking, yes
thats the part i am trying to wrap my head around is what do i need for central control.
OSS?
sorry new to this MP stuff
Online subsystem
Here's my advice : start small and simple with no dedicated servers, Steam for matchmaking, on PC, and build from there
Build the game, make it fun
That's the hard part
Once it's fun and you have people who like playing it as a demo or something, then you can work on infrastructure
oh the game has already been made. 😂 we had quite a lot of good feedback on it
but its only Single Player
it was apart of our main game and we had a lot of request for MP on it
so were rebuilding it now. :)
but the only MP experience i have is ark and dnl modding
So let's break it down
Multiplayer has three components : multiplayer gameplay (usually the hard part), matchmaking / friends / social, and (if that's a competitive game) the whole anti-cheating, ladderboards, ranking, servers infrastructure
Start with the first one
That's purely UE4 work
Basically play in editor with two players
Then, you can add matchmaking so that people can play with e.g. Steam
And then, you can look at cheating, scoring, ranking, etc
You can do the second part without Steam, too
It's just some work to add
well we have the MP part working
Very good advice and just a small thing to add, do decide if you are going with a dedicated server setup or not, I'd recommend the same as Stranger and use Steam and skip dedicated servers, but the MP code does have to be built a bit differently if the listen server host is also playing
but its only client to client
we have some things not replicating properly
but thats sorting them out.
What do you mean "client to client" ?
UE4 doesn't support that with the built-in networking
Do you mean listen server ?
Cool, so you have the hard part done
but thats not feasable for an online matchmaking game. lol
and were using the built in ue4 subsystem.
Steam subsystem works great to match players searching for sessions without port forwarding manually
You just need to drop Advanced Sessions in your project and implement friends
i was thinking that would be compatible with others but i guess not. :/
The built in OSS is only for LAN
ahhh okay
oh! okay
But you tell me you use the OSS already, so you don't need that
Just enable the Steam OSS and you can start using the friends API
Or matchmaking, etc
But I'm guessing you're not actually using OSS and just using "open ip" instead
yeah u mean console command open ip
Yeah
yup
If you're using that, you're not actually using any OSS right now
Again, OSS is not multiplayer, it's matchmaking, achievements, friends
You don't need it, it's just cool to be able to join your Steam (PS4, Xbox, Switch...) friends
So if you want to use friends, it's the only way, and you can look at Advanced Sessions for a primer
You also have the option to implement your own online service entirely yourself, build a database of players, a HTTP service that your game connects to, and be completely paltform-independent
You'll need a lot more work, but you won't depend on Steam or another
you could use services like playfab, aws, ..
or write your own backend for matchmaking , friendship, inventory, ... which I did 🙂
btw if its a turn based game you could write your game server without UE4
It's much easier to just not have any server
If it's a competitive game, you can just have each client upload the game log to the server and validate the game only if reports match
Which can be a dumb PHP server somewhere
On free hosting
You can use whatever you want no matter how shitty, is my point
1>The selected platform/configuration is not valid for this target.
anyone knows how to fix this problem while trying to build server
Yeah this is matchmaking essentially is all i really need to start with. Platform independent would be ideal.
@knotty ore You need to think about the intended experience. Not just one single valid answer here.
1>------ Derleme başladı: Proje: dedicated, Yapılandırma: Invalid Win32 ------
1>The selected platform/configuration is not valid for this target.
help please
Basically, if you want both to use the platform's (Steam, console, phone...) friends system, and platform-independent gameplay, this isn't something I know how to do
You can either build your own friends and achievement system, or drop platform independent, or wait for EOS to finally exist one day and work like annonced
hahaha
What is the 'proper' way to use a UMG widget to make a change to the GameState and show the change to all players? Should I make RPCs from Widget>ROS in PlayerController>ROS in GameState>ROC each Playercontroller>Eventdispatcher back to widget ?
Widget should call a Server RPC that is a member of the player controller
In terms of changes, personally I find it preferable to just have the UI poll the game for info each tick.
Touchy subject with some folks but frankly if you want to make a fully event driven UI in a multiplayer game enjoy spending your life debugging it.
thanks
heey guys, working on a card game. Does anyone have any clue how to build a queue or lobby system?
(or a tutorial for one or so)
I built one in C++ before we migrated over to UE4, but I have no clue where to plug it into the existing game's code
Hi all. Can Someone tell me if there is something I dont know about blueprint when creating a widget in a scene component then try to access it from the scene component. I get access none. any advice appreciated thx
hello guys, its bug for 4.24 or not idk but have trouble about variable replicated structures for everyone.
When i trying to send a structure with array(10) to client. it looks like i lagged or dropped from server. cant walk or do something till 5 or 10 seconds. after 10 seconds i can walk but some data didn't loaded cause lag or drop.
when i unreplicated it, then everything will works but then i cant get that data from server.
it was work perfectly before upgraded to 4.24 from 4.20(Bad choice i know)
if its not bug from engine, how i can fix this? Thanks to who can help me
I'm having a few issues with 4.24 so far. Server seems to be redundantly sending properties multiple times in my case. disabling properties for replication is more expensive than just letting them replicate pointlessly etc.
Not sure if my specific case is unique to 4.24 though
Too far in to turn back now
@chrome bay how bad is it?
So do you know.. about five minutes after typing that... I found my problem
After banging my head against the wall for 24+ hrs
just one silly mixup of true/false cost me a nights sleep 😢
knows the feeling
I also posted a massive post on UDN about my findings which I'm now going to have to shamefully close
I had a bug that didnt happen only on DebugGameEditor today... fun times
The irony is it's the most in-detailed post I've ever made.. net profile screenshots and graphs and everything. Godammit
At least print it out and hang it on a wall then 🙂
Hi people, I have an important question.
At high ping rates, server starts to correct player's location. There are some options to disable these corrections called
**- Ignore Client Movement Error Checks and Correction
- Server Accept Client Authoritative Position**
I'm not sure if I should enable them. Is there any risks if I enable these settings?
@rose prawn the risks are cheating, and whether or not that matters depends on if your game is successful or not
I don't really care about cheating
I'm mostly worrying about if it could cause any gameplay problems like having huge location distances between server and client
I suppose there might be some problems with client to client collision. If both clients are "right" then what do you do if they both say they're in the same place?
And the remote view is going to be twice as old since it's gotta go client to server to client. so basically, the experience is better for the controlling client, and worse for everyone else.
Thanks for the answer, I guess I need to look for different solutions :)
Tried in empty project with much structures line with array. it happens same bug like i said. Guess 4.24 bug. how i can send report for that?
you doing BP or c++?
Blueprint
never c++ :c
open empty project, make 8 line structure with image and strings
and make variable with structure in bp, and convert to array
make array 10 times in server and try to send to client
then all rpcs and variables stops in some seconds
you're sending an image reference or image data?
that is way more data then i feel comfortable sending
is the data static and known at compile time?
im just tried this
to see easier. in my project work like this
and there it stops receiving data in clients
or let me say other rpcs doesnt work when receiving structures
in that 4.20ver. works other rpcs same time receiving structures, idk what changed till 4.24
what does your output log say?
didnt look letme try again
How on earth would my ENetMode be Listen Server, but my EPlayNetMode be Standalone? Shouldn't these two be in sync?
nothing special, same as printlogs
how i can get very bad ping while local networking 
Bad code
Too many moves creates on each tick, etc
but you know there no moves except one character
its empty project mean UE4 thirdperson content
but i cant imagine while doing with public network
it would be completely broken
Ok so determined that somehow on Engine tick my world is set from standalone to listen server SetPlayInEditorWorld()?
This has to be a mistake because the rest of the engine thinks it's still in standalone
I didn't even think the engine allowed changes to the net mode at runtime??
Well of course
When you're playing alone, or joined to a server, or listen server, you have different net modes
(These would be NM_Standalone, NM_Client, or NM_ListenServer)
How does one set the ownership of an actor to a client's pawn?
Seems like if I call MyActor->SetOwner(this) on the Client, it's not replicated to the server, and so fails. But if I call it on the server then this is the server version of my client pawn... which means ownership remains with the server.
Needs to be done on server
There is no such thign as a server version of a pawn
If the owner is your pawn on server, it's also your pawn on client
Since pawns replicate
I must be misunderstanding something else then. I'm using the Gameplay Ability System and have it setup to locally predicate. The abilities are given to guns that are then triggered by a player.
I was setting the owner of the guns to the player's pawn, but the everything happening in the ability was displayed on the server. Debug lines, particle effects, and audio now show up only on the server, whether the player is a client or not.
Note that I'm not running dedicated server atm.
I'm just saying " if I call it on the server then this is the server version of my client pawn... which means ownership remains with the server" is not a thing
Ok, that is good to know.
You should be calling SetOwner on the server to change ownership of an actor
Once you've called SetOwner on the server, provided both objects (owner and ownee) replicate, you'll be able to RPC on the object from the client, as soon as the ownership replicates
Another follow up question then, assuming I have correctly done everything above, if I call IsLocallyControlled() on the weaponActor owned by the client's pawn, I will receive a true result when I'm on the Client and false when I'm on the server?
Dunno if IsLocallyControlled() is implemented for Actors, IIRC it's a Pawn method
Well darn, that is unfortunate.
Ok, say I did something like
APlayerPawn* pawn = Cast<APlayerPawn>(weaponActor->GetOwner());
pawn->IsLocallyControlled();
//Would this return true on client, false on server?
If you've set the owner of the weapon, on the server, to the pawn that you currently control locally, then yes, after ownership replicates, it should return true on client and false on server
Ok, good to know, thank you.
Hi people! I have a question about Oculus Quest and networking:
-We are making a multiplayer experience where a server is hosted on a Windows PC. It is not a dedicated server so the Windows player joins in as a 1st person character.
-All the joining clients are using Oculus Quest VR headset.
-Now, everything works great when up to 2 Quest clients have joined in. When a 3rd Quest connects, one quest randomly gets disconnected. (In most of the cases, it is the 3rd one). We have optimized and profiled lots of times and the bandwidth used is coming out to be relatively low. Has anyone ran into this kind of problem? Am I missing something that can cause disconnects like these?
What is the best way to play an explosion FX when something is destroyed? I created a "bind event to OnDestroy" and play the FX but clients cannot see the FX play unless I make the events "Reliable" which I don't really want to do. Am I doing this wrong? https://i.gyazo.com/e4c09ab555e0ed065e60128434ab8b99.png
RepNotify
Hey guys! Anyone knows why sometimes when I spawn a client on my server, the camera child of the client character controllers, gets parented to the server character controller?
Hi guys,
I'm working on a schedule system that will trigger certain event at certain time. I'm thinking that the schedule manager should only be able to start a schedule on the server.
So a couple of questions:
- Should I create the manager so that it only exists on server? If so where? In GameMode?
- Where will I initialize it? (loading up all the schedule, etc.)
- Do I replicate the manager actor down to the client? Since the client at some point will want to check to see if a schedule is active or not. Or is there a way for the client to just call the server and ask about the event?
Thanks!
Im having some issues getting my player to look in the direction that the playerstart is set. Im rotating the player controller to the playerstart rotation. Is there a setting in my player controller or possessed actor that's messing this up? This is only happening for the clients.
is there any templates out there for "persistent" worlds, like large MMO map, where everything is saved?
can be hosted online for players to join
so im using physics to move an actor. instead of the Replicate Movement, im working on something else. basically, periodically i have the server set a replicated variable to its location. on the autonomous/simulated proxy OnRep of that variable, i check the distance. if its greater than my tolerance, i set the proxy's location to what the servers location is. weird thing though... when it stops moving and the difference is 0.000, the location stops being updated by server (which is fine since theyre the same anyway)... but the actor snaps to a weird location. then when i move it even 0.0001, it snaps back to where it was before... moves just fine and all that... but then when it stops and the server stops updating, it snaps to a weird spot again. no idea why o.O any ideas?
I am trying to rotate the actor to an enemy actor. Function works very well. But something is wrong.
When I move the client it doesnt get input very well
When I press A it goes forward sometimes
I think it gets the rotation control for servers settings. Any idea?
add input vector to the pawn in direction of its/camera forward
CMC will RPC that to server under the hood
didnt understand the adding to the direction of its/camera forward
input axis nodes provide float -1 to 1
you multiply that float by Pawn's GetForwardVector for AxisForward
and with GetRightVector for AxisRight
and plug it into AddMovementInput
yeah, that make rotator needs to be deleted, along with add input vector node
but you said add input vector, did i connected it to wrong node?
ok i think its working now, when i deleted the rotator thing 😄
so the problem was make rotator
thanks @winged badger
you do have example and template projects from epic where this already works
its default 3rd person project
just studying replication on it
https://gyazo.com/ffd56a50a1d2431137a241728c86e97c one more thing, this started to happening when i deleted that rotator. my debug says it always happening when "character ref is invalid"
as i understand its clashing with server's rot again
i got super annoyed trying to forcefully rotate the character. gave up <_<
without a ref it needs to be inside the Pawn blueprint
or needs a reference to pawn or camera
shooter game is more advanced example project
also, read:
Ok I found my problem. Anyone know How to test client 1 and 2 with something other than Get Controlled Pawn. My blueprints think since I have Only 1 controller (my keyboard and mouse) I am always and only Client 1's Controlled Pawn when I press play.
I dont want to have to build a actual server just to test my blueprints...geez
any help thx
could you send a pic of your blueprints where you use get controlled pawn?
might not need to use that
@maiden vine
Anyone have any tips on how to package a project using dedicated server for shipping
project works fine with development builds just fine
same goes with server
yet it does not work if I build it for shipping
I couldnt really find helpful info on documentation or anywhere
what doesn’t work about it?
I can connect to server just fine with dev build
yet I cant connect to server via shipping build
server doesnt even see the attempt
is it a steam enabled game?
and are you running the server on the same steam account as the client?
server is dedicated
yes I know
when I first create widget also
using get controller node from character BP
with breakpoint I can tell by hovering over get controlled pawn its grabbing the opposite of what I want, and Im just testing the two clients
when you create the widgets do you set their owner ?
yes get controller pure cast to player controller plugged in to owning player
on create widget node
its like no matter what cant find a way to get the character of choice
something i dont know
thought someone would have a method for this
you know how you can walk with default pawn client 1
but if I click client 2 window then walk with that character is problem on begin play
I control client 1 so blueprints not right
Gotta be a different node or something for testing both
right? lol
I even tried the check box for routing 1st gamepad to client 2 no diff
not that I was believing that would do it
thx for the tries
guys, i still lookin or googling about that but still didn't get help
https://discordapp.com/channels/187217643009212416/221799385611239424/671814837881536532
Added any hidden "transfer or rpc runs limits" code in networking side between 4.20 - 4.24versions?
(i cant understand github repos. thats why i cant search about that networking codes.)
tried 4.23 too. its same.
my network speed is succ rn
I am attempting to utilize scene components with behavior to make a framework of modular behaviors that can interact. I also want it modular at run time so additional components can be added. Adding my custom comp replicates to the client, an on rep variable triggers behavior, the client receives it and runs a rotation lerp, but the client does not actually update the rotation client side, nor can it change the rotation of a client spawned mesh attached to it
whats the best way for clients to get what "player number" they currently are?
i have my game mode set each player controller ID as they connect, but i dont know how they clients get this information
tell them it?
or set there playerstate property to there id from the server, and have it replicated to client
what property in playerstate do i set? i can get an ID from it but i cant set it
Promote to variable then set it
If you can’t find one already
I haven’t messed much with player state
ok cool i made a custom playerstate for this and it seems to work so far, thanks guys!
Is there any way to mark a actor that exists in the level to not be created on dedicated servers?
blueprints or c++?
either way
you could use the isDedicatedServer to first test if the server is dedicated, then if it is, set the actor to not create
I can’t remember if you can get isDedicatedServer in any actor
might need to do it in a gamemode
you can, it's just GetNetMode
ooohhh I didn’t know that
But I'm talking about an actor that was placed in the world
Not one that I am spawning dynamically
right, that's what I'm doing
not sure if that’s what you want though cause it would still technically have spawned
Just curious if there was a property, but I don't think there is
yeah I don’t believe so
Does CopyProperties() in APlayerState only get called on the server?
