#multiplayer
1 messages ยท Page 412 of 1
Now, when I say that it stops being affected by SetActorLocation, let me clarify. I mean the new location does not get replicated to all clients. The new location is only available on the client that invoked the SetActorLocation.
Only after that client possessed and un-possessed that character.
SetActorLocation does not invoke the character movement though.
normally when possessed, movecomp takes care of replicating actor position
so a character does not have ReplicatePosition activated
have a look at what unposses actually does, i cant remember
the bReplicateMovement still is true, before possess and after, unless it's something else
Maybe you guys can set me on the right path of what I'm trying to implement next.
The maps that the players play on is fairly large. I want to be able to do a spell that'll set a waypoint to where the opponent is at.
breplicatemovement is for charmovecomp
oh okay
Gotcha, so it has nothing to do with SetActorLocation, only the ability to do updates via the CharMoveComp
yes
it could be that charmovecomp just wont do ServerMove when velocity is 0 etc
you ccan force it using client correction right after setting location on server
by calling ForceClientAdjustment on the movecomp
not sure how it works with no controller though hmm
That's the pickle ...
SetActorTransform is working just fine pre-possession
as soon as you un-possess it stops replicating the transform to other clients
when I hover over self it says it is not a idk class (idk is the player controller)
oh wait it says it is not an idk_c
or is the problem that as idk its not the owner it should be the target
oh wait I think I got it
thanks a lot btw I have been trying to fix this for a little while now lol @thin stratus
@manic pine thanks for the help, Character Movement definitively is the cause. As soon as I DisabledMovement, was able to once more properly replicate the position with SetActorTransform.
oh I have one more issue when I spawn in the second person's ui is still there and because of this cannot move
they spawn in but the ui just doesnt go away
you spawned it from BeginPlay?
oh
so you spawned a UI from the first player and UI from second player ontop of one another
AHUD derived class is generally best way to manage non-menu UMG widgets
it belongs to your PlayerController and is not shared
barring that, a Branch with IsLocallyControlled check will do the trick
it is worth noting that other stuff also executes on every instance of a Character, like Tick, and Overlap events
provided the whatever Actor is being Overlapped exists on the client
yes, its a BP Pure function
outputting a boolean
HUD is generally handy because it can access PlayerController, PlayerPawn and your PlayerState directly
and you are guaranteed that whatever widget it spawns, it will spawn only locally
no
i mean, you should not be using GetPlayerController[0] or GetPlayerCharacter[0] when you have an alternative
people make mistakes with those
your GetPlayerCharacter[0] in this example is "self" so you don't even have to connect the target pin
(assuming this is CharacterBP here)
likewise GetPlayerController[0] is GetController
and if you want a convenient way to remove or show that widget again, you should save the reference into a variable
GetPlayerController/Character[0] is generally safe in local splitscreen, its safe on clients, since there is only one match
but when used on a dedicated server it never works
or when it does, its by accident, to make it worse
the problem is when I make some of the things without the target I get an error
is that a PlayerCharacter BP?
oh
is it supposed to be
you can even have a level HUD override specified
where is the custom hud class
oh I see it
but how would I make it so when a certain map is open it shows the UI
or the widget
the hud is created when player receives his controller
oh
is there a way so the hud shows up at a time
or I guess the main issue is
that I need to make it for each level I can pick a character
at the start of them opened
if every map allows character selection then its a game feature, not a map feature, ye?
is there some problem with just putting the create widget in your main hud blueprint then?
well the main problem is that when I remove the widget for character select it doesnt for the other players
not the HUD class, not the Widget classes
wait so the issue is from something else
oh
yeah the issue is this
I picked the character but it doesnt go away for the other person still
both players have clicked?
yeah
but the second one has the widget still there
you can keep clicking it too and they will spawn in again
sounds like a problem with the Widget logic
follow the OnClick and see where it leads
since its working on one and not the other, there's probably some kind of authority check thing going on
assuming youre not on dedicated server
you named a class idk?
thats very original
ServerTPS/FPS runs as expected?
oh wait I got an error
after playing
Blueprint Runtime Error: Accessed None trying to read property CallFunc_GetParent_ReturnValue1 from function: 'ExecuteUbergraph_CharacterSelect' from node: Remove from Parent in graph: EventGraph in object: CharacterSelect with description: Accessed None trying to read property CallFunc_GetParent_ReturnValue1
ohh
ah
like in the graph?
how are the buttons created specifically
I put them inside a vertical box
and then I made it a variable
okay it still happened
even though I got rid of the error
wow
yeah, you might have a couple of problems here
when you say "get parent" in that function, youre not referring to the button's parent
youre referring to the parent of the widget/blueprint youre in
oh
yeah this could be hard to follow
It is very disorganized
but this could help
yes, that explains why its working on one and not the other
what you said before?
ServerFPS/TPS only runs on authority, yes?
the so called listenserver
and in that function youre calling RemoveAllWidgets
thats whats removing the buttons on that one
oh so how would I be able to fix it?
first remove the 'remove all widgets' entries
okay
you cant control UI from a server rpc
oh thats why it doesnt work I am guessing
yes, those ui calls youre making there(remove widgets, set input mode game only), only work for the listenserver player
oh so where would I add those instead?
but, to actually remove the buttons you'll need to change your widget bp
you can just call removefromparent on self(instead of getowner->removefromparent), that should work
but it might not be quite what you want
great!
oh wait one more thing its not that bad though the mouse just shows up
I forgot to set mouse cursor
yah, set that before or after remove from parent
um hello i've followed the one and only dedicated server tutorial on the ue documentation (https://wiki.unrealengine.com/Dedicated_Server_Guide_(Windows_%26_Linux)) and after all the steps, the dedicated server is not listening for connections. it's starting up as normal, but it is not listening, even though it says it is. what can i do? this seems like a common problem, yet i can't find anything on the internet about it
Did you open port 7777?
Do you get any errors in the server log?
How are you trying to connect to the server?
yeah, port 7777 is open
checking it with canyouseeme
used listener.exe to test if the problem is my port forward and when i listen with that, it says it's open
Do you have any custom code in AGameSession::RegisterServer?
only says something about failing to find a file which i don't really know anything about
nope
What file is it?
a mesh
A dedicated server shouldn't be loading art assets, but that probably isn't what's causing the error anyways.
How are you trying to connect to the server?
it isn't an art asset, it's used in c++
Alright, are you trying to direct connect via IP or are you using sessions?
umm i tested the port with a port checker to see wether the server is listening or not and tried with the exe to open 127.0.0.1 and that didn't work either
that would be via IP
Have you tried creating a blank level with a OpenLevel node in the level BP? I haven't read that doc you posted, so I don't know if it talks about this
yeah, i did that
Huh
and yes, it says you should do it
it's rather curious as another team member tried to make a dedicated server a few months back using a tutorial on youtube and he had the same problem. it wasn't listening
Does it say anything about a player trying to connect?
oh really
yeah, it's a dedicated server
on that article it says i should....ok hold on a sec, i'm going to try to start it without that argument
nope...still no luck
Will you post the startup log?
yeah that's what i was doing, one sec
unfortunately some things aren't in English as they're made by a guy in our team who for some reason likes to put non-english names
Alright, start your client, then open the console and type: open 127.0.0.1
You could also just try hosting the dedicated server on something like EC2. You might have weird network settings that are blocking the connection.
Could also be a firewall thing
Your firewall might be blocking all outgoing connections from the server.exe
client's not doing anything when executing that command
alright, lucky I already have an EC2 set up
can someone clarify for me "is locally controlled" determines if a pawn is local "not network" controller..... does that mean, if it's a client's owned pawn, it will return true, but if it's a server's pawn on the client side it'll return false?
or does it just mean if it's the server's pawn in general?
Where are you calling it?
on the pawn
if it means what I think it means, I'm using it on a multicast so that it doesn't over-write or re-write what happened on the client's side before the multicast
It returns if the Pawn's controller is local.
and pawn's controller is local means?
Sec, gonna break out my badass MS Paint skills
I'm bad with words lol
but you can use yes or no
if I'm a client, my controller is local?
or does it mean, only the server's controller is local?
Well, it's not as simple as that
lol
It doesn't mean only the server's controller is local
if I'm running this on the client
and I'm referencing the client's controller
is it local?
It returns whether or not your controller is local
So like
If you are playing a MP game
alright i'm back...it doesn't want to start at all on my EC2. it's giving out an error
what's the error @marble depot
If you are running IsLocallyControlled() on the client, it will return true assuming you are not going SomePC->IsLocallyControlled()
@proper olive
I don't have any experience running dedicated servers on windows, I only run mine on Amazon's Linux distro, so I have no idea what that error means
so the answer is yes?
Could try googling the error code @marble depot
Could I see the code where you call it @proper olive
IsLocallyControlled() will return true if the controller it's called on is local
and I'm asking what "local" means lol
local means you
"Indefatiguable means when something is not defatiguable"
๐
so it means what I think it means, I gather
thanks mate!
Like, that's literally what it means. Assuming you are not running local multiplayer. If it's an online session, local is context dependent upon who called it. But in general, it means the controller that is currently controlling your pawn.
yeah it doesn't want to start no matter what i do
Did you google the error code it was giving?
yeah, nothing useful
What did you put on the server? Did you just transfer the server.exe or did you also move over the bins?
the whole folder
i turned off the firewall on my computer and it's still not working
hey @manic pine yesterday you were talking about some server-side tick to use because the game mode only sends the tick .2 times a second or whatever, right? Causing the jittery boats? Is that accessible from BP?
you have to use client tick
so just if I'm using tick to modify the location, get the variable from a client RPC before operating on server or just operate the whole thing on client?
the tick variable*
not the tick variable, you need a time variable, ye?
I'm interping the Z axis to move towards the wave height on tick
this is on a component
on the boat itself
do you know what deltatime is?
I'm running it on client and server both, which is probably just the last bullshit halfass attempt of mine to fix it ๐
yea
the time it takes to render each frame so a multiplier of frames per second essentially
right, so its not gonna increase or decrease(unless your fps goes up or down), it'll just be the same number over and over
if youre doing 100fps, DeltaTime will always be ~0.01
o wow actually that Delta variable wasn't even being set properly in the first place
here it is on the player, which is also jittering:
gonna check out those boats w world delta seconds tho
is the Gameplay Framework Startup Order the same for Servers and Clients?
'cause it says in Editor, the Controller would get loaded first, but my Begin Play event isn't firing on Clients until either A) the entire Game Mode data is transferred or B) I use a multicast event from Server side to trigger the Controller to fire up, which then allows me to load in to the game before the Game Mode data is finished loading
so..... is there any way I can control that Game Mode data load to clients? And any other wisdoms?
Your controller BeginPlay won't fire until after AGameMode::Login() gets called.
oooh ok
and it's not safe to do any RPCs until AGameMode::PostLogin() is called
hmm I had some stray code on the map being triggered by my gamemode login so I cleaned that up will give it a go
and the RPC is being fired server side, like, say he's just hanging out and hits the Wave emote, that's what I'm using to kick start pending clients to load their controller begin play
if that makes any sense???
not a workaround just a thing I observed
so what prevents the gamemode postlogin from being called? it only seems to take forever (and longer) when I have more items dynamically spawned and saved in arrays on the game mode
so I'm assuming it's the downloading of that data that takes so long?
yea so it wasn't that random code unfortunately ๐
btw I'm pretty sure it's items replicating, 'cause I don't get the lag to load if I never spawn any gear
just lowered items* net priority to .5, didn't help.... also tried various dormant and only-owner-replicate things and none of it helped
That's not how net priority works
right
just ruling out possibilities
so it's the arrays of data on my game mode yea?
I don't know, what is it you are doing in your gamemode?
loading arrays of item data from save game, but only on begin play so I'm really just guessing here
or maybe it has nothing to do with the game mode
just all the actors in the world when logging in?
turning off the item actor replication completely doesn't help either, altho the server loads into the world instantly
so it's still a network thing
the server always* loads in instantly
this is a fuse cc character, ive done the bone retargetting manually, and maniquine is humanoid and both are, when i retarget this character to"Run" Animation , this is what i get.. LOL xD any advice??
both also share the same poses
Probably get better help in #animation
so when I bypass that network load or whatever, by using the wave emote on server, and load in as the client before all that data is passed through, I already see the item actors and everything so it's already run through the whole loop of loading all of them
there's just.... some blockage of communication between server/client when there are dynamically spawned actors in the level
no ideas ey? :/
I could make a video if that helps?
Yeah a visual would be nice.
I'm also currently working, so I can't really pay too much attention as I have my own code to work through.
cool beans
@snow violet and anyone else that wants to help with my client login/load lag problem:
A quick video to show that I've fixed most of the bugs and I'm working now on this lag for clients starting the game. I am spawning a lot of actors to manage...
I didn't show what I'm doing in my graphs but that can be pics, just lmk where you think the prob might be.... I can show you my inventory load/save system if you want?
hey guys
can someone help me ?
Like
im trying to make a simple online game...
and the first thing i wanna do
is just
create a room
where ppl can come in
i think the problem is
it isn't finding sessions
cause
when i do this
nothing happens
Like
in the menus for example
just no session appears
and relatively to the Blue print
i like
added a print string
in each between
to see where it stops working
and it stops working at for each loop
so i connected the Completed
and it says Success
so i suppose
since it isnt feeding Sessions to for each loop it just doesnt trigger the server widget
and even if it did (with completed) it wouldnt do anything cause it needs session information
So
why isn't it finding sessions
I tried one from editor and one from launch game
and then i tried Both from launch gabe
game*
doesnt work either way
if anyone could message me in private cause im going sleepy now and i rly rly wanted to solve this
cause its like a dream to make an online game xD
and i've watched like 2 tutorials
no idea what im doing wrong here...
thx ๐
this is the tutorial i watched btw
i did everything basically the same
Hey guys, I still cant make the volume louder .. Anyway this time I show you how you can: - add Steam to your project - Host a Game Steam/ LAN - Search for a...
pyrodev kinda fucked me over in some parts
it helped in some parts but I got a lot of problems
I had an issue where I couldnt find a session but all of a sudden it worked
what would be the owner of an AIController that is automatically spawned and possessed when spawning a pawn?
Hm, I assume if they have an Owner, then it's the Server?
AIControllers only exist on the Server afaik
Guys i have a big problem..
if i craete a new Project (3 person example), i create a empty actor(replicated), than i do BeginPlay->HasAuthority->delay(2 sec)->add testComponent(replicated)..
i start the game with 2 PIE. after 2 seconds the game when the component gets added, all players disconnects from the server with error (Stably named sub-object not found.)
I tried to reinstall UE4, create new profects (BP only and c++)
How do i fix it ? Or what did i wrong ??
Does that happen if the component is not replicated?
Does it happen if you use a different component? (replicated and not)
Is the Delay needed?
- It doesn't happen when the component is not replicated
- i don't know i only add that 1 component
- not really just to see that multiplayer works before and after that not
@thin stratus if i add the component in c++ it works fine..
@thin stratus I spawn the pawn with owner. instead of PlayerController I use PlayerState as owner so that clients will have valid reference too.
That's fine I guess, but what does that have to do with the AIController?
@rose egret
nothing ๐
:x But you asked about it
ah sorry I thought u said APlayerController.
because my pawn is spawned on server . AutoPossessAI is set to PlacedInWorldOrSpawned. so I waned to know who is the owner of Pawn's Controller ? Pawn ? Null or Owner Of the Pawn ?
my English is still weak and I can't ask well so lets talk with C++ :|
AActor* Question = pNewlySpawnedPawnWithPlacedInWorldOrSpawnedEnabled->GetController()->GetOwner();
What keeps you from testing that?
Simply print the Owner DisplayName
I actually never tested that, but I assume the AIController is owned by the Server (so no direct owner)
It only exists on the server so
BEcause you are only changing them on server?
Okay I am having an issue with something kinda weird
when one player explodes the other player goes back to the main menu
like they see the explosion happen but then it just kicks them out
Need code :P
Guys I know:
Its very complicated and maybe you cant understand my problem but PLEASE I need to know how that works:
ENGLISH:
Hello everyone!
I want to make a massive online multiplayer game and for that I need a server and a database.
Unfortunately, I do not know how to get
ahm theres probably a lot more needed as I never dived into creating a MMO, its just a massive task
But you could do build a dedicated server and maybe use MYSQL as database for saving user data, etc...
Thanks for the answer.
I already tried this but I want to save that MYSQL databse in a server so not on my computer its difficult to explain
then you could go with a cheap VPS and host your mysql there, I dunno about mysql hosting but I am certain there is too
When I print something out it says 'Client -2: hello'
What does it mean by -2?
Just to identify which client window that comes from
Yeah but whats with the minus symbol?
Strange that its appearing in one instance and not another though
I would like to ask a question, when I create a game state blueprint and play doubles in my game my widgets do not appear anymore. Why does it happen?
Does someone know a workaround for something similar to a replicated TMap ?
I'm sorry to reiterate my question, is anyone aware of what the "Netcode Unit Test" plugin does?
nvm found a solution
@twin juniper Do you know what Unit Tests are?
@twin juniper logically I would assume it's a network stress unit testing bundle to ensure the netcode behaves as it should in theoretical situations.
Guys i have a serious problem...
My Networking doesn't work like it should i think..
like i said before
I can't add a simple component(empty but replicated) to a replicated actor
it Disconnects all clients from server with
Error:
https://pastebin.com/trf4LTUV
Also i can't replicate a array (27000 size, INT array)with OnRep (in cpp) With
Error:
LogNetTraffic: Error: UChannel::ReceivedRawBunch: Bunch.IsError() after ReceivedNextBunch 1
LogNetPartialBunch: Error: Final partial bunch too large
Pls help me , I can't use the engine anymore if i can't fix it.. ๐ฆ
Also i tested it in 4.19.4 and in 4.20
I can't create a simple Int Array with on_rep or add a replicated Component
How can i fix something like that ?
I'm not quite sure I would consider a 27k-long array to be "simple" :p
It looks like the max partial size is 64kB, and you're exceeding that.
jeah i thing a 27k array is okay for replication but the engine can't handle any replication "things"
How could i fix it ? is it even a problem with the engine ?
how is that okay? you need a 10Mbit connection to replicate that array to 8 players inside 1 second
which is generally unacceptable
okay but even if i split that array to 9k arrays or 3k arrays it still doesn't work
also i can't add a replicated component to a replicated Actor
how are you doing that?
Beginplay->HasAuthority()->addTestComponent
testcomponent bReplicates = true;
TestActor breplicates = true;
try BeginPlay->HasAuthority->AddTestComponent->SetIsReplicated(true)
void UActorComponent::SetIsReplicated(bool ShouldReplicate)
{
if (bReplicates != ShouldReplicate)
{
if (GetComponentClassCanReplicate())
{
bReplicates = ShouldReplicate;
if (AActor* MyOwner = GetOwner())
{
MyOwner->UpdateReplicatedComponent( this );
}
}
else
{
UE_LOG(LogActorComponent, Error, TEXT("Calling SetIsReplicated on component of Class '%s' which cannot replicate."), *GetClass()->GetName());
}
}
}
void AActor::UpdateReplicatedComponent(UActorComponent* Component)
{
checkf(Component->GetOwner() == this, TEXT("UE-9568: Component %s being updated for Actor %s"), *Component->GetPathName(), *GetPathName() );
if (Component->GetIsReplicated())
{
ReplicatedComponents.Add(Component);
}
else
{
ReplicatedComponents.Remove(Component);
}
}
there is a little bit of a difference there, then just toggling the boolean
ofc, if your bReplicates is true by the time you call this, it will fail
Still same error
i'm still having problem skinned mesh didn't show in client side
@winged badger Ill just reset my Pc maybe that fixes it
@vapid mortar same problem as before, you must replicate those changes
void AActor::UpdateReplicatedComponent(UActorComponent* Component)
{
checkf(Component->GetOwner() == this, TEXT("UE-9568: Component %s being updated for Actor %s"), *Component->GetPathName(), *GetPathName() );
if (Component->GetIsReplicated()) {
ReplicatedComponents.Add(Component);
return;
}
ReplicatedComponents.Remove(Component);
}
:3
@thin stratus Yepperz! Just trying to figure out how the plugin works.
Has anyone setup vivox plugin in UE here?
how a custom structure change state is calculated? I mean how UE4 realize I have changed value of my replicated structure property? is it comparing just the memory or == opertor?
Having an issue with replication, and my Character Blueprint not executing commands such as sprint, jetpack, shoot, on the client side 1 instance of the game when played with 2 players. Will post videos
So, Server side can jetpack, sprint, etc. But Client side 1 player cannot. Anyone ever come across this before?
You'd have to show us how you've set it up, but you probably aren't using RPCs
I think that is also the issue. To be honest I have never set an RPC up, anyone know a good online tutorial?
I just used the Multiplayer Shootout2, to get basic multiplayer functionality, and am trying to expand on it from there to port my game in
how do I correctly use custom net serializer?
https://paste2.org/z4UwXLan
TestRep0 is not replicated at all. NetSerialize don't get called ever ๐ฆ
@timber nest i have used this method, just set things you only want to replicate after the multicast
so 2 custom events, other run on server and other multicast, and choose what path it takes if server
Ok, so for a sprint command. SERVERDostuff would be the Client Sprint, what would I call the second event?
Sorry really new to this
Teacher says Im getting in over my head, but Im hungry! lol
Look at exi's network compendium, it's pinned in this channel. You won't understand unless you do so
Will do. Thanks!
@timber nest, about those nodes you can just copy them. just make another custom event SprintMulti, like in the upper picture is MULTIdostuff. after the multicast you set your character speed, possible character movement changes (animations) etc..
Hi All! Random question about optimization:
If I replicate an FVector and FQuat is it more efficient to send an FTransform with the FVector and FQuat in, or to send them individually?
Wondering if the individual overheads for the Vector and Quat total more than that of the FTransform with the Scale Vector in?
I'm assuming individual is the most efficient but I was interested whether it would be cheaper with an FTransform, despite the 2nd FVector due to any overheads I might not be aware of
@slate veldt Vector + Quat is better . though u have to use compressed alternatives like FVector_NetQuantize etc
A transform includes scale, so it should be cheaper to send them individually
Sure thing, I thought that would be the answer but sometimes there are some interesting surprises!
I've seen somethings before (not necessarily ue4) but the larger struct sometimes has a cheaper cost than the individual components
what do u mean by cost. all structures and basic data types like float int are serialized . the more you compress them the less bandwidth u use
dw, it was probably something I've read ages ago that I've mis-remembered! Thanks for the answer
for instance u can see FHitResult::NetSerialize to find out how ue4 do the net serialization ๐
TY @late sundial and @sharp pagoda Will let you know how it goes!
How to properly replicate widget button being disabled from client to server? i tried creating replicated variable in game state and casting it to widget but it disables button on both client and server only if server clicks it, if client clicks it, its only disabled for client.
That's because the Client is not allowed to set the Replicated Variable
That's the whole idea of Server-Authority
Please read my Compendium which is pinned to this channel
@brave moon
Does building a dedicated server require the engine be built by source? Most tutorials I see on dedicated servers all build engine from source, wasnโt sure if this was a requirement or not
@fierce haven Yup
Thanks!
Also if anyone knows how the experience on hosting a Linux dedicated server as opposed to a windows server? Is it more difficult to manage or have any breaking bugs or is it totally workable for production?
Clients will be windows ofc
hey, is anyone experiencing also issues with advanced sessions plugin currently? we dont see any sessions. But it worked earlier^^
i know that sounds like a stupid question but can someone quick show me how to add replicated components to a replicated actor at runtime?
I have hard problems with it the last days and my way i did it the last yearrs seems to crash everytime ๐ฆ
Pubg company told me to add a halo sticky grenade to shooter game. Ive already implemented it
but i wanted to comment on the design on something like that
do you prefer favoring the shooter?
at the moment im doing collision detection on both the client who launched the nade and the server. The first one to get a hit attaches the nade to the body of the enemy
this clearly favors the client. but i wanted to know what you think of something of that sort
do you know what exactly is overwatch doing with the tracer sticky grenade?
material for an interview
Oh
the typical thing
do X, and then in the interview we talk about it
at the moment i have it as very "favor the shooter"
i was also thinking of making it mask latency through animation
Well, if you get on PUBG
you'll be the boss in no time
So, go with whatever you want
They kinda need people with skills
i think ill continue with favor the shooter, but add anticheat code
at the moment the launch grenade function is a very trivial Server call
wich im also thinking if i should actually do the grenade in the client and the server just replicates a proxy of it
to have "0 latency"
i was doing that with Arrows for my VR game
becouse any latency on a VR game feels like ass
It definitely does
Damage?
So you didn't use any stock
i give zero fucks about server checking or anticheat
You basically did your own damage system
well, it was fairly simple
i have a Bow class
when the bow is drawn, a couple replicated variables get hit (so the server also spawns an arrow and attaches it to the hand of the player)
when the arrow is thrown, it calls a Server function with the launch info (direction and point)
the server then launches its arrow (wich is the replicated one)
when the client arrow hits something, it sends another Server call
basically a Server_RegisterHit(FHitResult hit)
the server then replicates that to make the arrow dissapear/explode at that location and replicate the damage
damage is also done clientside here
but its like fake damage
You're still using the server for the majority of things
i trigger dmg number and anim
uhmm
the server is just there to replicate the arrow to other clients tho
But yeah, I see what you did
what its 100% clientside is the sword of the player
all the sword combat is clientside
parries, damage stagger, etc are all triggered clientside
in fact, for a player to receive damage, he has to receive damage clientside
the server is not checking collision of anything
the server just controls the AI and "triggers" an attack animation
the rest of the combat is done clientside
Which needs to be set by the server right?
yes, damage is set by server
Aye, so not 100% ;0
But yeah, I see what you did
so when a player hits an enemy in the face, all the damage code is triggered, and the server triggers it too
obviously, the server does not trigger stagger to the same player that already staggered the enemy
that would cause doublestaggers
and double damage numbers
I have my weapons running client-side mostly logic, only thing that gets verified is the hit location
But still a bit tricky, especially when the latency is real
to test latency, i play with my character artist
and if i want to really test it, i play with my character artist, while both of us use wifi
as wifi packetlosses quite a bit
tfw my grenade is already better than pubg grenade ๐ค
HOLY FUCKING SHIT VAX NOW GENERATES BOTH _IMPLEMENTATION AND _VALIDATE
10/10
best plugin
it does
it used to be quite fucked with it
now it only needs to do "return true" on the validate function
and it would be 11 out of 10
Can i replicate a array of size 27000 ?
if its an array of bytes, barely
its int
then no
why not
if its too many bytes why doesn't unreal do it "longer" instead of instant transfer and split it up into little arrys for sending ?
-,- now i have to split my array into 10 arrays of size 2700.. ?
i cant believe its 2018 and unreal doesn't have a good documentation/tutorial on dedicated server. Me and my other friend have been trying to get a dedicated server to work for 1 month. trash
UWorks has a decent example and some docs, iirc
its not free tho
(double check that info before/if you buy it, as i just breezed through the dedicated server bits)
is there a repnotify type event we're supposed to use to convey permanent changes to new joining players? For example on beginplay, I have a little function that removes a component from the player / actor and it works, it replicates, except new players that join in can still see it.
removes it how? replicated component?
its a component inside the player (a replicated character actor) and I execute a custom event (run on server) to destroy component
component is local inside the character actor
you can still reference it over network tho
as long as it has a Name
and if you exec DestroyComponent on BeginPlay
with no networking whatsoever
then the component will be destroyed on every instance of the Actor, on every machine
working on my first networked game, does anyone know what could cause player join to get stuck at login screen here? if i connect through open 127.0.01 it works fine. but using join session it gets stuck at loading screen indefinitely
this is my game instance blueprint which has an event LaunchGame (aka host) and Join Game, which get called accordingly via button click events in the widgets
disregard, fixed. was forgetting to set the local Session before calling join server. /derp
why would that only change the speed for clients and not the server?
It does move the server pc forward too but doesnt change his walk speed like it does on the clients
What does that mean?
Stably named sub-object not found.
Hey guyz
Quick question: why does one character launches another character in the air when spawned?
Is it capsule collision or what?
They spawn 150 cm away from each other
With default capsule components
@hardy dome - yes you are correct... collision responses. Make sure to set the skeletal mesh to NO COLLISION - and leave the capsule component to its defaults. Any components you add to the system need to ensure that they are not blocking PAWN or any other custom object channels you may have created... as it will also launch characters.
A bit of a PITA - but teaches you how to troubleshoot & properly apply collisions to your project โค
the capsule component is a default BLOCKER for the ability to NOT OVERLAP on top of other pawns...... unless of course you want that. so wha ti'm saying here is that you need to keep its collision setup because you need that NON-overlappability of your AI
so the server should spawn projectiles, but does that mean clients should see the servers projectile or should they see their own?
It depends on the situation. You can spawn non-replicating projectiles on both the client and the server if you're sure that the projectile won't impact other networked actors which could lead to a misrepresentation. If you're spawning something like grenades which are definitely going to become desynced, then you could spawn a replicated projectile on the server, which would propagate down to the client. @steady briar
im still figuring things out but im making an arrow that sticks into what it hits. works 99.9% of the time and thats considering im firing them like a machine gun instead of slowly like a bow
its more of the thought behind it being done correctly or not
i think theres a slight difference between the server and client projectile, so if i hit the edge of a moving target, the client one stops because it thinks it hit something, but the server one keeps going and then it fixes the client one when the server one hits because i attach it on server hit
if that makes sense. i dont always explain things very well <_<
if i play as the server it works, but as a dedicated client it has a small space for error, which would probably only get worse during real usage
ya but is it wrong right from the start though? like, am i seeing the projectile i should be seeing?
having an arrow suspend in the air because it thinks it hit something can look pretty bad
Hey, I am more the designer guy and not the developer. But I am looking for an tutorial for battle royal, anyone know an good one? I find one on YouTube but this is not complete and the owner stop with this.
@shut quarry You don't need a tutorial for an entire game. If that exists, then you're not creating anything players will want to play. Think ahead on paper about what your game is like, and then implement the features individually
Learn, practice, try things, change until it's great
@bitter oriole this is only the basic ๐ for sure I have my own features as well. But I am looking for the basics first!
The basics is a shooter
Battle royale is a shooter with 100 players
That's about it
ShooterGame covers it all, though it's a bit complex
i know a lot goes into anything but shooters probably have the most built-in stuff and examples to go on
@bitter oriole sorry but I ask about an tutorial and not for some politics and your vision of the life
You found out yourself that tutorials for an entire game don't actually exist
I'm telling you why
@shut quarry why not ask whoever made the tutorial?
I also gave you an additional pointer - ShooterGame is like, 99% of a BR game
@steady briar I do and he stopped because of time and YT money haha
Complete with matchmaking friends etc
u can use the built in shooter stuff for most of it, the rest is visuals/modeling
@steady briar yes I think this is my plan now. Stuff like lobby, menus, connection all this is done. Only stuff like inventory, weapons etc is missing
is it a persistent inventory or pre-defined in the round?
i think for a lot of shooters you dont need an inventory really, its more of a "press this button, take out this item" which is a lot lighter than a full blown inventory system
ya so you would need a menu that assigns a pre-defined weapon and tell it -that- is what "2" or whatever button does
And inside of the Battle Royal u can do small quests and work on your karma and for all this u need an inventory
unless player 1 "Rifle5" is different than player 2 "Rifle5" it shouldnt be too much to do
Yes
yes what, and what battle royal do u mean
I send u an pm
its royale btw unless ur talking about like... princes and kings fighting i guess
Shhh, politics ! ๐
Hmm. What's the most efficient way to send a mostly constant-length list of fixed-size structs?
Error: Stably named sub-object not found.
Any ideas how to fix that ?
did you try to replicate a reference to that component too?
something alongside the lines of AddComponent->SetIntoReplicatedVariable
yeah i was trying the component stuff too, but ive never done dynamic replicated comps in bp before
no go no matter how i tweaked it, with or without replicated reference
replicated reference to a component that is not yet added to the ActorChannel would be a problem
In general, these are the guidelines to go by to determine if you can reference an object over the network:
Any replicated actor can be replicated as a reference
Any non-replicated actor must be stably named (loaded directly from a package)
Any replicated component can be replicated as a reference
Any non-replicated component must be stably named.
All other UObjects (non actors or components) must come directly from loaded packages
Components are stably named if they were:
Loaded directly from a package
Added via simple construction scripts
Manually marked (via UActorComponent::SetNetAddressable)
This should only be used when you know you are manually naming the component so that it has the same name on the server and client (a good example are components added in an AActor C++ constructor)
Quick question - if an actor is replicated and has a component that is replicated, can a pointer to the component be passed via RPC?
@vocal echo what i pasted right above your question is the rules for when you can reference objects over network
I'm using a playerstate to store Team selection but it's not working on re-spawn for some reason.
Set-up: Choose team > cast to playerstate > set team variable (name) > play.
On death > spawn character > possess.
On possess > cast to playerstate > get team name > switch on name > execute logic based on team selection.
Looks like the team reference in my playerstate isn't getting passed around or the characters I'm spawning aren't technically controlled when the attempt is made and playerstate is null.
@winged badger Completely missed the line about actor components in that! Thanks mate
is choosing a team replicated to server?
any input action you want the server to take note of has to be RPCed @unique thunder
also, if you are selecting a team on a different level, you might end up with a different PlayerState instance
SeamlessTravel being the only version where it persists
Ah yeah that was dumb of me, I re-worked the logic a while ago and forgot to run the team set on server
I have this other thing I tried to modify but it's not working in a multiplayer scenario so I'm not sure how to handle it
Set-up: Spawn projectile, delay 0.012 seconds > run server event > run multicast event > set projectile mesh visibility to true.
On hit > destroy actor (self)
as far as I know, visibility toggles have to be multicast but this now causes my projectile to remain visible after death somehow & clients don't see their own projectiles
why would you introduce additional lag on server/other clients?
I just need to keep my projectile invisible for 0.012 seconds, is there a better way to do this?
on every machine?
BeginPlay of the projectile Actor
SetTimerByEvent (0,12 sec delay)
then set Visibility from there
just use a set vis node there? will it replicate?
it doesn't need to
every instance of that Actor on every machine will run its own BeginPlay
weird, I was told that visibility toggles had to be multicast to all clients to replicate the change everywhere
the difference here is
but I guess since the projectile being spawned everywhere, each client runs their own instance
that BeginPlay acts as a Multicast
but without an actual RPC involved
you can do it as the timing is specific, 0,12 seconds from when it spawns
so the SpawnActor ends up serving as your SetVisbility Multicast in this case
That makes sense, thank you
@winged badger Those guidelines don't really seem relevant to the problem here though, seeing as it's failing the entire replication process and booting the player with something as simple as this in a random actor:
@worthy wasp tried setting all the character meshes to NO COLLISION, but they jump anyway on spawn. Also those meshes are a bit bigger than capsule components, maybe that's the problem?
All, I'd like to have a player spectate from another team member when they die. I've set up a simple camera blend like so: https://gyazo.com/480346c589a00d897715087e72ff7ab9
However, the spectating camera is rotated somehow: https://gyazo.com/d0c776cb58cb24c6a92f2c4f0326546d
If I turn on replication for the camera, then it glitches considerably: https://gyazo.com/2829b6391cfbfb09c8eca966abca9a9a
...any ideas?
Why replicate the camera? Why don't you just spawn a new camera on the spectating client and attach it to the simulated client's pawn?
why a new camera though, it already exists
Well the simulated client's camera won't exist. But yeah you could re-use the players camera who died and attach that to the new pawn
I don't understand, the first example here above (bottom screen, the dead player) attaches to the camera of the other player (top screen), so both cameras already exist... no?
Right, you can use the dead players camera and attach it to the player you want to spectate. You don't need to replicate the camera to do that tho
understood, my replication attempt was to fix the fact that it is rotated... which is my issue
ahhh
I am not using the dead player camera
i am blending to the living player camera from the dead player camera
ah okay, I didn't think those would exist for simulated clients. Guess I was wrong
yeah, cameras are just part of the default character bp
are you manipulating the camera in any way on the local client
because, at least by default, the weapon mesh will be attached to the camera itself
so even if your camera was wrongly tilted, the mesh(hands + weapons) would still look right
the weapon mesh is attached as component
attached to what
to the hand socket of the mesh when equipped
camera is part of the character BP
pretty standard stuff
the default is:
Camera
-> Hand mesh
-> Weapon mesh
where hand/weapon mesh are both owner only see i believe
yes, weapon is spawned dynamically so not part of character BP
how are your use controller pitch/yaw/roll settings
Has anyone ever made a shared multiplayer quest between two players?
quest is on the server, everything about the progress is tracked server side
only thing you replicate is the information Players need to keep track of their progress
10-4
Helloo guys
I have a Array of max size 27000
I would like to replicate the array
How can i do it ?
not sure you can
tarray replication is limited to something like 2048 items and 64kb total
supposedly you can manually remove this limit by editing engine source, at the cost of other potential problems
hey guys, so I wanna put a name above items around you when you press an item, got it all working well for server, but in theory... my items are spawned server-side and I guess their variables and everything gets replicated to clients, so when I want a client to change something on only their instance of it, it doesn't want to work, right? Cause it really only exists server side? So I figured ok, I'll just spawn an array of widget components (blueprint only here) on client side, but that won't work cause you can't do that right? They have to be pre-existing components? any thoughts on working around this?
how it looks server-side. Client-side can get the item highlight working so I don't really get why it won't work, I have the component on each item actor, set to replicate
what?
is that just a simple "No" to big array replication??
no like... I'd have to limit the # of nearby items
to whatever amount of components I have on the character ready to assign to nearby items
I'd rather just spawn them dynamically but the node says "internal blueprint use only, do not call manually" for spawning widget components
oh sorry you were talking before
lol my fault
xD its okay
@next falcon what do you want to replicate?
I'm using big arrays replicated too, haven't tried with massive #s of things yet
an int array of max 27000
because if its something along the lines of a procedurally generated information
you could be better off just replicating the random seed
having the clients re-create the array themselves
ive gathered that the epic team wants to do big data replication, but never read that they actually implemented it
jeah i do but if i change some number in it, i need to save that somewhere and if i changed everything i need a complete new array
so i think youre stuck with either working around it(dividing it on multiple arrays or whatever) or using your own socket
do a delta array
i.e. members that have changed
iirc array will replicate in its entirety
so changing one number in array of that size is costly
you can always RPC the change itself tho
make it a pair, like <indexofmemberthathaschanged, newdata>
when client receives it, it knows to change the original array
of course, youd still be limited to 2,048 changes
change how?
any changes that players make that's affecting that array
would have to be RPCed to server
so it would be server authority, just like everything else
so it's only a max of how large of an array if you're trying to transfer all of the data between server and client*? so if the transfer is simply an index #, then you can store a huge array on server?
example:
Array from Seed: 1,2,3,4,5,6,7,8,9,0... MaxSize: 27000 CurrentSize: 27000 (not replicated, only the seed)
Saved Array: 1,6,3,8,5 MaxSize: 27000 CurrentSize: 5 (only on server)
Modified Array: 1,6,3,8,5,6,7,8,9,0 MaxSize: 27000 CurrentSize: 27000 (On Server and Clients)
the saved array is implemented into the generated array and Can be up to 27K and that i need to replicate or get the data from the server
so um.... sorry to interject but here's what clients see when I press the button in my situation:
i just skimmed your above text @proper olive
you can have WidgetComponents on your Actors
that will show the widget locally on some condition, filtered by IsLocallyControlled
that works only if you have a simple use case, as in you press E and item is used, depending on its Interaction interface how
if you need a more complex interaction however
so this changes the name whenever it needs changing
and above sets the visibility of nearby items on that component when pressing a button
the name is replicated to everybody, so it has the name saved on it
for other purposes
it was in use for other stuff already
I just tried adding a multicast btw, in case the name was blank for some reason, but that's not it - I can access the name by clicking on the actor and using my other code there
widgets arent replicated
the problem is the replication of the visibility of the component
even widget components?
you need a trigger that works locally
I wanna just spawn the widget locally
for example, have the Actors track the LocalPlayerPawn
but you can't do that at runtime in bp?
or react to an overlap
keep in mind, the client can do whatever he wants to an actor(short of destroying it)
yeah I have it doing on overlap rn
when I run this code on client it doesn't set the visibility of the component tho
OnBeginOverlap->Cast OtherActor to Pawn-> Branch (IsLocallyControlled) -> SetVisibility(True)
maybe I need to spawn one of these on every actor on every client?
not just have it be a native component?
native component should be fine too
just run is locally controlled?
you just need to set text content and make sure its visible when you want to
you can set the text content on beginplay, then do like Zlo says on overlap
to toggle visibility
when I hold the L button
which is in the above screenshot
like diablo "show interactable items names" kinda button
I just changed it to use IsLocallyControlled and no network RPC
I'll see how it goes
running on the controller tho
you can do it from Pawn, but you will need to find nearby items
having 4 chats atm, so i must admit i didn't read through the BPs
basically you'd need to find nearby items, filter them by class (interface better) and then call the interface function that sets the visibility of widget component to true
no networking, just local exec
^ that's the trick hopefully
hiding them is more tricky, since you need to hide it both when user releases button, and when the item is outside the range
the IsLocallyControlled....
I could change it to fire on a timer
and save them all to an array, clear the array
check distance etc
easy peazy
do not check distance, check distance squared
it's often just "getting it to work on client" that's the hard part ๐
but if you're tracking you'll have to retrace anyways
and then the dreaded "seeing it on other clients" ๐
yeah so just clear them each time
because what you described wouldn't catch the new items that you walked into the range of
they are not supposed to replicate
otherwise whenever someone presses L all widgets would pop up for everyone
so I'm thinking I need a RepNotify to spawn widgets clientside?
repnotify is for replication
well I could easily filter it by IsLocal is they replicated ๐
youre not doing anything network-wise
^___^
the items are dynamically spawned, saved/loaded
doesnt matter
like i said, clients can do whatever they want with replicated actors
except destroy them
not sure what you can do from blueprint
yeah :/
doesnt matter though, you can just make it part of the bp class
maybe I can ask in bp chat since this seems to not be a replication issue
that seems wise, the only part of this that requires replication is the actor itself(obviously), and, in some form, the name you want to display... and maybe not even that, depending on how much the client knows about the object already
yeah I'm gonna try just spawning a .... :deep breath: normal widget :sigh: instead
๐
oh that won't work for 3d space anyway nvm
okay guys other ideas i can try?
Split my array into 30 arrays(900 Size) and that doesn't work.. :/
you manually wrote 30 array declarations?
yes -,-
2 times
first in a struct to test it but failed
than in in the actor itself
what do you mean with "big" ?
how many bytes does a single array element occupy
its a int array
ah, so 4
jea
well, its not reaching the limit then(900 * 4 < 64*1024)
and not the element limit
so technically it should work
well i do a 3d loop for adding it
does that effect it maybe ?
what do you mean by adding it
for (int X = 0; X < 30; X++)
{
for (int Y = 0; Y < 30; Y++)
{
for (int Z = 0; Z < 30; Z++)
{
//Select array from Z Index and add it to array
}
}
}
what are you adding it to?
just so we're clear, your arrays are declared like this ye:
UPROPERTY(Replicated)
TArray<int> Array1;
first explain how you know its not working... are the client-side arrays empty?
but the server side arrays are full yes
yes
and youve confirmed server-side theyve no more than 900 items
yes
hmm youre always running into the weirdest of problems
are you getting any log errors
its a silly approach, having 30 replicated containers just like that, but i dont see any immediate reason why it wouldnt be replicating
if the actor itself was reaching some kind of limit, i'd expect it to throw some error
or at least a log entry
at this point it would be worth checking the Actor is indeed replicated
especially if its the same one with the troublesome component
i ran into that one too zlo, 100% reproducible
could you try that on a random actor?
i'd expect it to work, but it doesnt
no problem in c++ tho?
ive done dynamic replicated components in cpp many times
i really dislike some aspects of BP replication
i think this might be somethign to do with the "AddComponent" function... or just bps, i dont know
rarely use them
force the local value of a replicated variable (with RepNotify) to change on the client
okay guys ill get some food now and think about it and than test everything in cpp
huh, does it do that on authority too?
it does
thats very inconsistent with cpp
and very inconventient if you want to bind functions to delegates
since you can easily end up doing it twice
yes, could get very hard to track
@next falcon this is working fine for me
actually works with 5k elements too, though its taking 5-10 seconds on the client before he can begin play since its part of the initial replication data
imo, there has to be a better way to design it, then to replicate an array of that size
agreed, but i dont know what kind of data this is
i don't either, but the entire idea of "hey, lets replicate a 100kB array" would be a non-starter for me
if you had a listen server with shitty ADSL connection and 8 players, it would take upwards of 10 seconds just to replicate that array... once
haha ye could get very nasty
@manic pine do that 30 times for 30 arrays and tell me if it works xD
xD
with that amount of data, even in different arrays, you might be running into a partial packet limit
i think the engine only allows something like 512 partials or whatever
just to let u know what i try to do:
I try to make a chunk-based world system like minecraft
The chunks are 303030 = 27000
if something changes everyone needs to know
30 * 30 *30
does everyone need to know everything immediately
only the guys who replicate the actor so who is near the chunk
distribute some actors around in a 3d grid
each responsible for his volume
set network relevancy distance to something sensible
distribute some actors around in a 3d grid what does that mean ?
well lets say you have one actor at 0,0,0 another at e.g. 10000, 0, 0 (100 meters away), etc., etc.
yes
each is responsible for the part of the world between him and halfway to the next actor
yes
when player gets into relevancy range of one of these actors, it's replicated to him
along with any part of the world that actor is responsible for
okay yes
thus, the most data any single actor has to replicate to clients, is the chunk he's responsible for
and only part of the world that is relevant will be replicated
yea but i still need to replicate the volume of at least 1 Chunk which is a 27K array
27k blocks in one chunk?
yes 30 Block * 30 Blocks * 30 Blocks
well, you can take that further down at your own discretion, right