#multiplayer
1 messages ยท Page 562 of 1
Does anyone know of a simple method of checking whether you're connected to the internet? I could try to connect to a server as usual, but I don't want to even try if I'm not connected to the internet as the client would have to wait for a timeout
Is there a simple way to ping googles server, for example
ready the people uses the right cmd console, what I'm looking for is to create a package that she can manage her own server in my game
@weak wind for this you need to create your own system.
@split siren you don't need to have 2 different server builds, basically what you want is to spin your server with different map. I m sure that you can specify the map to load via command line parameter
@rich ridge this system as I do because everything is black when I open the console
@rich ridge Well, though true, it is useless for Lobby server to have gamplay knowledge. So I would like to exclude those modules from the build.
@weak wind why don't you use UE4 to make a simple application which loads and executes your server.
@split siren you can't exclude the module, you can only unload them.
@weak wind you can create a simple windows application using unreal engine which will have ui to list and run other applications -> your server
@rich ridge I might be wrong here, but would it be just a simple target.cs edit to not include certain modules?
You you specify a module in build , then you don't need to write extra code to load them.
If you haven't mentioned any module , then you need to write extra code to load the module, using FModuleManager
@rich ridge but I can distribute it to people to create their own servers without it editing in the editor?
@weak wind to create server you need entire engine, so there is no short cut to this
But you can create a simple application uisng UE4 to manage
Thank a lot for the help @rich ridge. How would one specify a module "in build"?
You can specify the module in 2 places, build file and uProject file
i understood is that I wanted to distribute server versions without the person having to mess with the engine and change dev files
My apologies, I think I should explain my goal. I have logic for Lobby and "actual game", both running on different servers, that means code (GameLogic) module should not be packaged in LobbyServer and vise versa.
i understood is that I wanted to distribute server versions without the person having to mess with the engine and change dev files
@weak wind It is doable but requires a lot of changes
@split siren not possible. You can only control when to load module.
@rich ridge i'm willing to do it because I want to create public versions of servers so others can administer
but what I need to do to create because I don't know exactly what to do
@rich ridge thanks! I have searched for few hours but glad you confimed it! You rock!
@weak wind a simple question to you, you want to distribute your server but they can't modify it. So what is the usecase
What you want to achieve
I have a question about replication: Take a given actor. it is spawned on the server and since its set to replicate, it will also spawn on all clients. so far so good. now this actor used the projectile movement comp. but neither it is set to replicate nor is 'replicate movement' set. But since velocity x=1 and both initial and max speed are set the actor will still move for all clients after being replicated there (its just not synced with the server ,but I don't care about that atm.). since I don't care about anything but the initial replication, I then call tearoff() on the server. This all works fine, except that the lifespan does not count down correctly for the torn off instance. Normally DestroyActor() is called once the actor hits something, which works fine both server side and client side, but if it does not hit anything the 'client side' actors (that are TornOff()) never are destroyed (until they leave world bounds), server side is destroyed once the value set from initial life span hits 0.
it seems to be that no matter what I do, GetLifespan() is always 0 on the 'client', although the initiallifespan value is correct on the client. It seems as though the 'TimerHandle_LifeSpanExpired' is reset or 'nulled' when the actor tears off, but I don't see where or for that matter why. So I guess my actual question is, am I missing something obvious here? (btw. I guess I could also spawn the projectiles on the clients via a rpc but I thought using 'initial actor replication' would also work..)
@rich ridge let me see if I understand them, will be able to move type putting commands, change the day, status of characters, climate, and teleporting players that are stuck on the map
Ohhh now I understand your requirement, it's kind of config for the game which should be controlled by central admin not the dedicated server
this is only that the central administrator if it is a want he can download a version and create his own so that he can administer
@heavy comet always spawn things in server. If you spawn projectile on server it will be replicated to to all clients and whatever happens to projectile blast, explode, die will automatically replicate to all clients.
Set the lifespan on server that's it
yes, that's ofc. correct @rich ridge . and also basically what I'm doing. the question is, why does TearOff() apparently break the Actor lifespan timer for the tornoff instance
@rich ridge want to do just as I do in ark I download the server file so I can administer my server
@weak wind I haven't explored the ark game. So I can't comment how it works
ok but it would be more or less as you commented above just want that so people can build their own servers and administer
What I can suggest you is that your dedicated server should dump the data including the players on map or whatever you want to read from current game session.
And then you need to parse that dumped data
You also need to have set-up your dedicated server to accept commands from third party link to do actions like move player etc
If you want to allow people to build the server then you need to ship your code in form of DLL, and let other people to choose the engine they want to build against
I understood that if I make a server package as I did in this could do without using the engine for this
Good afternoon. I have a question about attachment and replication of object references.
I spawn an actor that on BeginPlay spawns an array of four actors and attaches each one to a different scene component on itself.
I'd like this to work on clients as well. I've read that the AttachTo function must be called on each client. When I try to attach on each client however, I'm finding it difficult to get a reference to the parent actor.
So my question is: What's a reliable method I could use to get a reference to the intended parent actor on each client?
Cheers.
I think I don't know the definition well but I think it's this client server
Hey all, I've been at this for a month, and have got to the point where I need your help in getting MP widgets to work. It seems that PIE using single process is messing with the widget input, but I'm not sure. When I restart UE, the hand beams for the VR character work on spawn widget actors. It does not work the subsequent PIEs, though. This is non-dedicated server. I'm trying to get widgets to spawn and only be visible/interactable from the owning client. Using 4.22.
Here is the BP code for the hand-hovering interaction, called from event tick on the motion controller actor, as well as the spawned widget and spawned gameplay item (which includes a widget in its component list). Those are called from the player state (because I want to wait and spawn one gameplay item per logged in player). Please @ me, as I may not be able to check so frequently throughout the day.
*Some of these graphs may need to be zoomed way-out, as they include multiple RPCs in one graph so I didn't have to create multiple paste bins
Hand beams: https://blueprintue.com/blueprint/kb6bz3or/
Spawn widget: https://blueprintue.com/blueprint/h1zzy1iu/
Spawn gameplay item: https://blueprintue.com/blueprint/vy1qz_sf
@waxen socket Iโm so close to being able to answer that question myself as Iโm dealing with this sort of thing, current bugs are preventing me from answering reliably though :(
However, in my case I have used the actor classโ owner as well as stored hierarchy in replicated vars but this may not be best practice
@waxen socket You can do an external call to the owner from begin play, or any other event, on the spawned actor. You could also get a reference to the owner on the graph which is doing the spawning, then plug it into an exposed variable on the "spawn actor of class." Exposed variables are input variables on that node. You have to rmb>refresh nodes for it to display, after you've compiled your code on the actor which is being spawned (which now has the newly-added exposed variable)
I.e.: The "screenReference" here is an exposed variable, from the BP_ScreenInput actor's graph:
what I'm wanting is that if the person wants to make a server she can host and administer only with the package version for windowsserver
@young yoke Thanks. That's the method I tried first but it would appear that at least objects don't immediately become available on clients when passed in that fashion.
@lilac bear I'd be very interested to see your completed solution.
For now, I've resolved to check the validity of the owner on a looping timer. ๐คทโโ๏ธ
@weak wind @Zeev you ship your final server build, and whatever values your admin can tweak expose it via some kind of API or config file.
I increase an int in the GM to 2 before seamless travel but when the next map is loaded up after seamless travel (same GM), the int is back to 1 (default value)
I had thought that properties persist during seamless travel in the GM
Do some properties be passed by options string to persist or am I just messing up somewhere?
@rich ridge ok i will do thank you
what is the header you need to include to use DOREPLIFETIME_ACTIVE_OVERRIDE? getting a Use of undeclared identifier 'ChangedPropertyTracker but DOREPLIFETIME and DOREPLIFETIME_CONDITION works
@grizzled stirrup you need to mark the properties to get persisted after travel.
hey guys, where are you supposed to add the UI/HUD widgets to the player in a muliplayer game
From PlayerController
if i do it on event beginPlay, then every time a new player joins, the UI is duplicated
How?
im pretty sure youre supposed to do it from the HUD class accualy, the playercontroller has an instance on both clien tand server but HUD only on client
where would i find the associated HUD class for my PlayerController
this is running in my thirdPersonCharacter, and for some reason causes duplicates when a new player loads in
i think its because it is called server side on the new joining player
you do it in your hud class
i don't have one?
create one?
okay
@rich ridge How can I do that? I don't see any CopyProperties function in the GM like the PS has? I can only see an ActorList array but that doesn't take into account GM variables
Hey guys Iโm trying to get some info about servers for my game. Itโs a 6 player match based game and we are trying to figure out if we should stay peer to peer or if there is some work around using dedicated servers that wonโt cost us a fortune. Or if another solution may be on the table. For@some@clarity of the style of game and what you might expect going on in any given match. a fair comparison might be something along the lines of Friday the 13th just with the killer being AI. We are trying to find a solution that makes sense for our game but we know peer to peer can be a pain. Also if you know general cost of these things let me know thanks. Sorry if this is the wrong channel.
P2P works great if cheating isn't a problem
And it scales infinitely since players host their own matches
So it's a lot simpler to setup and maintain than servers
An overview of how travelling works in multiplayer.
GameMode is not persistent in nature
Yes it just mentions persisting actors and not properties on the GM but does say that the GM is persistent By default, these actors will persist automatically: * The `GameMode` actor (server only)
So while the GameMode actors persists, it's properties won't?
I guess you need to wrap them in actor
That will also do
Just thought it might persist automatically as it says in the docs
Cool thank you
Gamemode can change
Yes but if it doesn't change it can't persist properties right?
Other than the ActorList
Even though the docs says it persists automatically
@grim remnant up
Does anyone know exactly how expensive bReplicateMovement really is in terms of it's run time?
Because I'm questioning whether or not to do one of the following:
Have a USceneComponent on an actor that has the actor replicated movement, and use this scene component to determine the firing point of a projectile
My second option is:
Have the client send a location from a USkeletalMesh socket from the client, to the server, and have the server validate it in some way. I'm not sure how this could be done safely though.
How expensive is it to replicate movement of a gun, and of projectiles
In my first scenario, the weapon will be socketed to the players hand socket on their mesh, thus replicating the movement when the player moves.
Hi, I'm having some problems about object classes here, it prints the class of the added object to the screen correctly but in the editor it registers as "none"
I can't pull any data from the added object, it returns nothing
What might be causing this I couldn't figure out
This does not happen in singleplayer
And it happens to both the server and the client
I found that server can read the value but clients can't
Hi, I'm having some problems about object classes here, it prints the class of the added object to the screen correctly but in the editor it registers as "none"
@dire cradle Try setting that InventoryComponent to "Component Replicates" = true
Does anyone have a answer to my previous question (about widget interaction not working for spawned widgets)? ๐ Where would be the best place to spawn a widget and have it be only accessible/visible to a specific player?
I tried that before it still doesn't work
Clients can read the length of the array correctly but can't read it's contents
what is your datatype for your inventory items?
It was custom objects with data inside them, then I changed it to class references from object references and it still fails on the client. I didn't use datatables because I had to have different scripts inside the items.
Then I tried with some random arrays and clients still couldn't read any content out of them even though the array is updating correctly.
if you want to use UObject you have to make them replicatable.
ie: something like FastArraySerializer
What is FastArraySerializer
And how do I make UObjects replicatable
I'm not using C++
But even if objects failed to replicate, it's not the only array that can't be read on clients
I will probably switch to datatables to see if that will work
you'd need c++, or to do it a different way.
Hi, im using the smooth sync plugin, but currently it doesnt replicate animation, has anyone figured out a way around that?
you need to use C++ for fast array serializer
there are certain parts of the replication pipeline that require the use of C++
custom netserializers, fast array serializer, and fast delta serializers all require C++
Is it impossible to make a functioning multiplayer game with blueprints?
For now, I've resolved to check the validity of the owner on a looping timer. ๐คทโโ๏ธ
@waxen socket
@waxen socket looping timer? ๐ฎ
sorry all, this comment appears random and cluttery, just wanted to make sure to get Flynn's attention later. I'll try PM next time
hey guys, how do you respawn a character when they hit a kill z (either world or volume)
i tried this
in my game mode base and called it from my character onDestroy
Hi, im using the smooth sync plugin, but currently it doesnt replicate animation, has anyone figured out a way around that?
@jovial stream This is a good video: https://www.youtube.com/watch?v=WFAy5nYWCRE
In this tutorial I'm going to show you, how to fix pawn replication. This technique is very usefull on other replication problems.
What's the current maximum landscape size supported out of the box in 4.25.3 without having to implement custom network code? (Hosting, not dedicated server). I'm seeing conflicting reports on this one
Depends on the game
Depends on the machine, too, on some level
Usually the answer is something like 2km away from zero
Just looking for a ballpark figure, I'm hearing 5kmx5km, 20kmx20km and some even saying in newer UE versions even higher. Guess we still need to wait for World Comp to work in multiplayer
It's a float issue so the UE version is unrelated
It's a processor architecture and international standards issue
And it's not really an issue but a compromise for performance
As to world composition in MP, it's likely impossible
Especially for player hosted
Dedicated works pretty well with World Composition then?
Nope
By the way you're thinking origin shifting, not composition
Composition itself works, the error-mitigation shifting does not
And the reason shifting can't work in MP is that it simply moves the zero closer yo your character - that's not possible on a server that has multiple characters
The answer there is to move the engine to 64b floats, and that's not happening soon
Sorry, I thought they were coupled together. Thanks for the explanation.
They kind of are, but the composition aspect should work in MP, though it's probably pointless since your level size is constrained anyway
I guess the guys going for huge MP landscapes are doing the origin shifting by themselves them
Define huge, really, Fortnite is like incredibly fricking huge without origin shifting
Isn't that way more than 2km though?
Never actually played the battle royal version ๐ just the first campaign season
And that's quite an incredibly large level already, that only works gameplay-wise because of the shrinking radius mechanism
Without that games would go on for days
If you're not doing a fighter plane simulation, you likely don't really need more than that in your MP title
... Not to mention the absurd cost of populating such a level
Thanks for the explanation, 2km is really more than enough for a long time ๐ now to work out the components/quads/sections/scale . I'm probably looking at one of these 2 options if my maths is right.
Hi, anyone knows attaching / detaching replicated actors is any issue?
how the fuck do i do shit on begin play?
i want to add a widget above a head of a player but client can't do that
cuz the pawn hasnt replicated for him i guess
whats the solution here?
@gusty raptor I'm having issues with it so from my perspective, yes. ๐
so what about detach a replicated actor on server, and then set its position
here, the client is detaching the actor to late, and not gets the location set at all
using replicate movement *
Most advice I've read says you have to run the attachment individually on each client. It's probably the same with detachment.
I just surprised myself. I set a reference to an actor to replicate, and it actually did. I was under the impression that objects couldn't replicate?
could anybody help my weak brain understand when i should be using the player controller vs the pawn event graphs?
I think I understand, but when it comes to performance, wouldn't putting as much as you can in a player controller help? as it only exists for the individual players? Or am i missing a fundamental part of how scripting affects performance
it doesnt really affect performance where u put ur info
are you doing multiplayer?
i am, i was thinking in terms of just a host server
honestly i think my brain is just burnt out and i'm missing something
yeah dude networking is fucking bonkers
for sure looool
I think your classes can be as large as you like and it won't affect your networking. It's your RPCs, replicated variables and etc. that will slow it down.
okay, that at least makes me feel confident
u must know what goes where tho
u gotta use playerstate/gamestate/gamemode/pawn/playercontroller in conjunction
bcoz of how each class replicates and where it exists
And you have to know when to use what and if you get it wrong you'll never be able to forgive yourself and as the days turn into years you'll tell your grandchildren that if only you had done health logic in a component if might have been you instead of the football captain that found success and true love.
basicly
sounds like you guys are havin' a tough time
Oh, you know.
foooor sure.
Bud.
It's not so bad. You just have to be willing to suffer a lot.
The little epiphanies along the way make it worthwhile for some.
oh yeah, i'm like year 3 just forcing myself to repeat tutorials to just make me understand. I have tried so many things that were way too complicated for me, i've done everything so wrong so many times
i definitely know pain
the epiphanies are so worth it though
I mean, they a'ight.
Does anyone here have an opinion on the Smooth Sync plugin? It looks like a miracle cure for replicated movement but that's what makes it so suspicious.
Hmm...
I'm hesitant to rely on a plugin but it seems that it has excellent support.
What's wrong with your original replicated movement? Don't think I've ever had problems with that in my multiplayer projects.
Hey, Authaer. The problem is choppy movement. If I can avoid having to write prediction and interpolation, it would be nice.
Are you using custom movement components? Both floating pawn and character movement should work very well by default.
My character movement is okay. It's the movement of plain actors that's choppy.
As well, Smooth Sync claims to replicate physics movement well.
@waxen socket my player's movment is also very laggy as well
I tried using smooth sync but it doesnt support animation replication, which is a problem for my uses
I read that they added animation support, no?
wait they did?
ill look
where did you see that?
I dont see anything that says it supports it
Here's what I saw: https://forums.unrealengine.com/unreal-engine/marketplace/1492482-smooth-sync-sync-your-transforms-smoothly-across-the-network/page11
Version 1.15 has been submitted to the Marketplace.
Change Log:
New Feature! Added syncing of Movement Mode (animations).
New Feature! Added automatic syncing for velocity of Movement Controllers for animations like walking / running in Third Person Template.
Fix for owner time becoming off after some length of time which caused syncing to become erratic.
I know a lot of people have been waiting for the new feature of animation syncing and for a fix for time becoming off. I'll message each of you after it becomes accepted. It's usually about a day or two for them to accept it.
forumtitle.png
Link to Marketplace (https://www.unrealengine.com/marketplace/smooth-sync)
Hey! I didn't see any way to sync from client owned objects
The creator seems to have a really good response time so you could ask them on the store page, through their email, or on their discord.
can you send the link to the discord?
It's here: https://discord.com/invite/6VpgNQg
thanks!
Good luck!
@waxen socket have u tried smooth sync already?
im wondering how does one sych anims
using that plugin
No, I don't own it. I'm trying to gather some expert opinions on it but... it would seem that networking experts don't use it.
what is ur assumption based on
Limited research.
Searching this channel reveals to me that most of the regulars here whose opinions I respect don't see the need for it or haven't used it.
i see
are you familiar with replicated movement?
is it like, you send walk impulse to server, server says ok, you move on server and then you move in your pc after some milisecond delay?
That's the approach I've seen the most of, yeah.
Client sends requests to server, server updates character on each client.
what are you trying to accomplish?
Well, if you don't delay then you either have to predict the movement and correct it if need be afterwards or trust your client and that's prone to cheating.
here comes in cheating
I'm making a side-scrolling space shooter with four-player co-op.
my philosophy is- if the player wanna cheat they cheat, why overcomplicate ur indie game because of cheaters who will find a way to cheat no matter what?
thats how all main multiplayers games go
check fps shooters, csgo, pubg, planetside
Yeah, I'm not worried about cheating, I'm just telling you what I know. ๐
I've been using "ServerTravel <mapname>" to move my players from a MP lobby (where they can play minigames, chat, etc.) to the actual real level.. unfortunately now this is causing issues due to actors spawned in the lobby not being killed when the real level loads.. Is there any way to have the server change level, clients to follow but anything spawned in the previous level destroyed automatically?
Player movement replicates well for me using the built-in systems. It's my nonpawn actors that lag. I think Smooth Sync might be the ticket for me here.
Have you used Smooth Sync with physics actors?
@waxen socket There is a built in physics replication system and it's probably better. Unless smooth sync can do some clientside prediction magic.
There is? This is the first I've heard of that.
@soft shell do you have seamless travel set up? Normal traveling between maps shouldn't be leaving actors around, thats normally an opt-in feature
hello guys all good , well wanted to know how this function works for creating dedicated server but I'm doubtful with comandline to puts the executable more the map path or have to put the ip?
hey all, is it possible to use the OnlineSubsystem GooglePlay to handle sessions like in steam?
@jovial stream Just a side note from earlier. If you can help it, don't replicate animation stuff. Replicate the variables that a client would need to do their own animation stuff.
I see OnlineGooglePlay does not support a sessions interface... how is it possible to do session based multiplayer with google play then?
@jovial stream Why do you need to replicate animation data directly?
@kindred widget Yeah I'm just gonna do that, thanks for the suggestion
it seems to be the way to go
@jovial stream You typically want to replicate the minimum amount of data needed to construct the game state on either side. For example, for a very simple shooter, you could replicate only movement, input commands, and aim direction. That data would be used on either side to drive the animation etc.
yeah I really only need to replicate the aim direction and a few bools for movement
The character movement component is already replicated, and so is the control rotation. All you need to do is handle the networking for your actions and you'd have a very simple shooter running
Use control rotation, it's replicated by default
@dark edge would I get the control rotation from the player character or from the controller?
Unreliable RPCs can be dropped with high network usage meaning they are never attempted to be sent, what would be the best way to make sure that UE4 tries to send an RPC at least once? without using Reliable RPCs with the ACK/Resend overhead that comes with it?
Essentially its okay if some don't of the RPCs don't arrive on the client, for what ever reason, but UE4 deciding not to try sending them was not what I had in mind, I'm thinking increase the available bandwidth is there any other setting I could look into?
Is there anyway to guarantee that a replicated Actor spawned by an ActorComponent will be replicated at the same time as the ActorComponent?
I would make the Actor an ActorComponent, but UE won't allow an ActorComponent to have a child ActorComponent ๐ญ
@final thicket I dont think there is an alternative way, if you want to guarantee a RPC then use reliable
sometimes it's good to make 2 versions of the same function, one unrealiable and one reliable (I've seen this in engines source code somewhere, actually)
I would make the Actor an ActorComponent, but UE won't allow an ActorComponent to have a child ActorComponent ๐ญ
My encapsulation and reusability principles are suffering severely because of that Constraint
@livid holly I don't mind if they don't arrive but I want to ensure a request is sent, reliable messages are a lot slower, and they are ordered the order does not matter here!
I want SPEED ๐
Is there anyway to guarantee that a replicated Actor spawned by an ActorComponent will be replicated at the same time as the ActorComponent?
@floral crow You shouldn't replicate components, just pass traffic through the Actor into the component
Its more effective avoiding network overheads, UE4 does it with their character movement component
I don't want to. That means I have to have my Actor be a massive monolith knowing about all the internals of its components. That defeats the purpose of having a component in the first place
Is the Unreal way making everything a semi-monolith?
No way to use composition with proper encapsulation?
All networking traffic is passed through the actor any way
But I don't have to code it manually. So I can add/remove components without having to touch my main Actor
That's why only actors can be replicated and not objects, but I do see what your saying
If I route everything through the Actor then I have double-sided coupling, the worst of all coupling
๐คทโโ๏ธ
No way to use composition with proper encapsulation?
I'm still hoping I am wrong and missing something, but your answer makes my think I was sadly right about that statement...
Just make an interface
Implement that interface
and then route through the actor
Modular enough
Hmmm......
Can I guarantee that two actors constructed on the same server tick arrive to the client at the same time?
No
Why?
That's why I'm using components in the first place
No why does it matter what actor is created first?
Because they're guaranteed to arrive with their owning actor
So I don't have to setup timers looping every couple ms to wait for the whole thing to be replicated. Only then I can initialize them and be able to use the thing
Replicated components will arrive with the actor they are a part off
Replicated components will arrive with the actor they are a part off
@final thicket Yes I know, that's why I liked them. It avoids me from receiving an Actor made of modular pieces piece by piece, when they don't make sense unless they're all together
But now, the constraint of not being able to compose these ActorComponents is making me want to go back to TryToInit looping timer hell
hey I cant seem to get my component move to node replicating, how do I do that?
hey I cant seem to get my component move to node replicating, how do I do that?
@oak pond Prbly replicate the movement of the actor
wdym? mostly everything else is fine
and everything else in the function the move component to node is in works too, its like it skips it
Are they on a Nav mesh?
These are AI? @oak pond
no this is for the player
What does it look like for the client?
when I have two players one of them can use it fine and the other one gets teleported to the map centre
this is for a wall climb function, and when the client climbs up the wall its fine but its when it hangs on to the ledge that it is teleported to world centre
Only the client teleports to the world centre?
how so? it just doesnt replicate the location properly for the client somehow
def a problem with your logic
yeah you got that right lol
soo maybe show us what you are doing?
@meager spade Any comment on my issue above?
for most functions its fine when I just put it through server events then multicast but for this it just doesnt work with location
๐คท link me lol
I also heard relative location cant be replicated, so I hope its not a similar issue
Unreliable RPCs can be dropped with high network usage meaning they are never attempted to be sent, what would be the best way to make sure that UE4 tries to send an RPC at least once? without using Reliable RPCs with the ACK/Resend overhead that comes with it?
@final thicket Here
Sorry for being grumpy @final thicket , appreciate your help anyways. I guess I need to adapt my mindset to the tools I'm given
Essentially its okay if some don't of the RPCs don't arrive on the client, for what ever reason, but UE4 deciding not to try sending them was not what I had in mind, I'm thinking increase the available bandwidth is there any other setting I could look into?
@final thicket Here
I was aware they may fail to arrive, I was not aware there might be no attempt to send them ๐คฆโโ๏ธ
Sorry for being grumpy @final thicket , appreciate your help anyways. I guess I need to adapt my mindset to the tools I'm given
@floral crow I didn't get that impression at all btw
if its is crucial, then send it reliable
if its done via a tick or something
then unreliable HAS to be used
if something MUST always be valid, then use a property on a replicated actor
It can not arrive, sometimes but its not ideal
the CMC for player movement is al done via Unreliable RPC's
Hard to explain but I need the speed of an unreliable RPC
you just fill the gaps in to make it smooth
Its not CMC related, but yes that's true
you will get a update at some point
unless you are really hammering your RPC's
btw i would suggest increasing your RPC limit
On a similar issue (but with replicated variables instead of RPCs) we had to increase the replicated variables data cap
btw i would suggest increasing your RPC limit
@meager spade Is this the amount of RPCs that it will consider sending or the amount of RPCs you can have?
i have it set in DefaultEngine.ini
[SystemSettings]
net.MaxRPCPerNetUpdate=10
MAX rpc per net update
oh lord, I just realised I dont know how to get the right player controller id when I need it, for a camera thing for example
default is 2
[SystemSettings]
net.MaxRPCPerNetUpdate=10
@meager spade That sounds like what I'm looking for...
I hate this hidden throttling they do... really bothers me
how do I do this for the player I need it on?
currently it just limits the camera on player 0 of course but it needs to be the right one
only LOCAL controlled clients.
Ah you mean simulated proxies, okay that makes sense
@jovial stream The controller owns the control rotation but I think pawns have a local duplicate of it
@oak pond exactly what mechanic do you need it to do?
this is just for temporarily limiting the camera rotation
But what drives that, when is the camera rotation limited?
hi everyone, im new here.. can anyone help me with my camera direction? the client & server doesn't see the same thing ๐ฆ
@meager spade Not trying to be pedantic just when I hear* remote clients I was thinking about their network role, not possession
@jovial stream just to tag on, use GetBaseAimRotation from the pawn in the AnimBP, it has the rotation and the pitch
its when the players grab a ledge but that event is replicated
@oak pond You presumably only want the camera to be limited for the character grabbing the ledge, correct?
@oak pond Movement logic should be added to the CMC, (Character movement component)
yeah
Then why would you need anything replicated at all? Just restrict the camera when you do the grab locally, or when the grab is replicated out, check if the character is locally controlled before restricting the camera
...thats a good point
@dark edge can i PM you so you can help me a bit more?
@fossil ivy I'm sure go for it
@meager spade Thanks for telling me about, net.MaxRPCPerNetUpdate would I change this in default.ini? and is there a list of these somewhere that I could look at all the values?
christ this is so frustrating
I'm running into a bit of a weird problem. I have a variable in my game state that specifies the type of game we're playing (Free For All, TDM, etc). The variable is setup by a console variable when launching the dedicated server. A client launching the game does not set this variable. The variable (an enum) is replicated in the game state. When a client joins the server I want to set this variable on the client's game state, however it doesn't seem to be working. I've tried using an RPC and even just setting it on the client using a client only function and no dice. Any ideas?
@fading birch Expose On Spawn?
Yes its true and that might just be for things that your spawning
how can I configure the dedicated server commands using the frontend?
it should be fine just to replicate the variable
c++
You have implemented void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override; ?
void ABaseGameState::SetGameTypeServer_Implementation(EOceanicGameType inOceanicGameType)
{
O_WARNING(FString::Printf(TEXT("Current Game Role: %d"), OceanicGameType));
SetGameTypeClient(inOceanicGameType);
}
bool ABaseGameState::SetGameTypeServer_Validate(EOceanicGameType inOceanicGameType)
{
return true;
}
void ABaseGameState::SetGameTypeClient_Implementation(EOceanicGameType inOceanicGameType)
{
O_WARNING(FString::Printf(TEXT("Current Game Role: %d"), OceanicGameType));
if(GetLocalRole() != ROLE_Authority)
{
O_WARNING(FString::Printf(TEXT("Current Game Role: %d"), OceanicGameType));
SetGameTypeServer(inOceanicGameType);
return;
}
OceanicGameType = inOceanicGameType;
O_WARNING(FString::Printf(TEXT("Current Game Role: %d"), OceanicGameType));
}```
I know how to code block ๐
that's my current iteration of it
So why are you not just using a replicated variable and not these RPCs?
also your not telling me what calls these originally?
Im starting to be really convinced setworldlocation and movecomponentto just dont replicate
these are called by the game mode during OnPostLogin
and the variable is replicated
.cpp
DOREPLIFETIME(ABaseGameState, OceanicGameType);
.h
UPROPERTY(BlueprintReadWrite, Replicated, Category = "Game State | Variables")
EOceanicGameType OceanicGameType;```
Show me OnPostLogin
EOceanicGameType CurrentGameType = GS->GetOceanicGameType();
O_WARNING(FString::Printf(TEXT("Current Game Role: %d"), CurrentGameType));
GS->SetGameTypeServer(CurrentGameType);```
OnPostLogin is a strange place to do this, btw
You don't need to set the game mode every time a new player joins
we're trying to update the variable on the client as we display different widgets depending on game type
Where do you set 'OceanicGameType' on the server?
@meager spade thanks, Ill take a look at it!
uint8 gameType = 99;
if(FParse::Value(FCommandLine::Get(), TEXT("oceanicGameType"), gameType))
{
if(gameType == 0 || gameType == 99)
{
O_WARNING(FString::Printf(TEXT("Parameter oceanicGameType was specified with value of %d. This is outside the parameters of the enum. Defaulting to Free For All."), gameType));
OceanicGameType = EOceanicGameType::FreeForAll;
}
else if(gameType == 1)
{
OceanicGameType = EOceanicGameType::FreeForAll;
}
else if(gameType == 2)
{
OceanicGameType = EOceanicGameType::TeamDeathmatch;
}
else if(gameType == 3)
{
OceanicGameType = EOceanicGameType::Landmark;
}
else if(gameType == 4)
{
OceanicGameType = EOceanicGameType::Intercept;
}
else
{
O_WARNING(FString::Printf(TEXT("Parameter oceanicGameType was specified with value of %d. This is outside the parameters of the enum. Defaulting to Free For All."), gameType));
OceanicGameType = EOceanicGameType::FreeForAll;
}```
Can I create a replicated Actor instance on a C++ constructor? Does that make sense to UE4?
@fading birch Did you break point that code, making sure it gets set correctly?
Have you tried doing any break pointing?
Break point the client function and test it
the client doesn't call that
it's set to run on server only
so the client is just using default value of 0
which is fine
I mean breakpoint this function, SetGameTypeClient_Implementation
it's correct:
So a couple of things this is hard to debug without actually seeing it, but it feels like this should be a replicated variable not an RPC, and you should be using ON_Rep aswell
Show me the whole GetLifetimeReplicatedProps the header and the C++
You should use an on rep
there is no doubt there
but if you cant show me the GetLifetimeReplicatedProps that I can say it looks like its setup right
oh you mean this?
DOREPLIFETIME(ABaseGameState, OceanicGameType);```
i had pasted that earlier
this isn't my first time working with replication
and the other variables within my game state do replicate properly
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
// This part here.
}```
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME(ABaseGameState, OceanicGameType);
}``` So it looks like this then?
I'll be honest I don't have any more time for this atm but here me out, just replicate the number with an ON_Rep function and set the enum
Goodluck
thanks for the help
I tried adding a child ActorComponent to my ActorComponent, and it ended up adding it my Root Actor, which is perfect for my needs! I'm so happy ๐ฅณ Had no idea that was gonna be the result. I wonder why it's so widespread that Components owning other Components is not a possibility
I thought it was not even gonna compile
I didn't help much, your setup is very strange its strange that both your replicated functions SetGameTypeServer_Implementation and SetGameTypeClient_Implementation seem to call each other
Just go simple and setup that ON_Rep
@floral crow Glad you got it working
rep notify still doesn't seem to fix it
You cant just rep notify a number?
Just rep notify a number, and use that to get the Enum, possible your enum is not setup correctly to be replicated I duno
@meager spade yep that seems to have fixed the problem [SystemSettings] net.MaxRPCPerNetUpdate=1000 ๐
why are there so many hard to find network throttling measures...
Btw @final thicket , I tried searching for the MaxRPCPerNetUpdate CVar on the engine source. Typically I'd find those type of Config variables on classes like NetDriver. But It showed up there... What the
@final thicket no idea tbh. This is maddening. enum is setup like a regular UENUM
my other enum replicates just fine
@meager spade Thanks for telling me about, net.MaxRPCPerNetUpdate would I change this in default.ini? and is there a list of these somewhere that I could look at all the values?
I'd also like to know if there's such a list, as regex searching for Config UPROPERTYs is quite a cumbersome enterprise...
I need to learn how to make 3 servers cheap, or for free to test? any ideas...
SO Many includes
Hey everyone,
I am trying to broadcast a message from my server to all my clients.
To do so I am using a NetMulticast function inside my APlayerController:
// .h
UFUNCTION(NetMulticast, Reliable)
void BroadcastPing();
void BroadcastPing_Implementation();
// in .cpp
void AMyPlayerController::BroadcastPing_Implementation()
{
UE_LOG(LogGame, Warning, TEXT("BroadcastPing_Implementation."))
}
// inside a function called every 4 seconds for client #1
{
BroadcastPing();
}
I thought this was it, and that this would work right. However this is unfortunately not the case.
The log is called on the client #1 but not on my other clients!
I then tried to move this function over to my character, same exact code, called on the server. There I do get a call on each client, however, I am not able to get access to the controller. Meaning, GetController() will return NULL for some reason I do not understand.
void AMyCharacter::BroadcastPing_Implementation()
{
// crash! GetController() -> NULL
UE_LOG(LogGame, Warning, TEXT("BroadcastPing_Implementation %s."), *(GetController()->GetUsername()));
}
Any idea what I am doing wrong here? I feel so confused by this issue!
player controllers are not replicated to other clients
a multicast on the player controller will therefore only appear on that one client
@fleet raven ohhh! ahhh! That makes sense! Thank you so much! I will use the player state instead
Is there some default behaviour that kicks players that go out of map bounds? ๐ค
No
We've currently run into an issue where navigation isn't building correctly on dedicated servers. We have a persistent level with a large navboundsvolume, navigation set to dynamic (project and on recastnavmesh) and on beginplay we stream in sub-levels procedurally, however, it's very hit and miss if it generates properly. Has anyone encountered anything similar - or ways to solve?
Specifically it works if you just play the level directly in PIE but not if its run as a dedicated server
what does the LogNet: Browse: MapName log indicate? When trying to join a multiplayer map, this log shows up with the map name of my Title Screen. Is it trying to move me to the title screen before moving me to the multiplayer map?
@raven tinsel player state are replicated to all clients butyou need to loop through all player state to send multicast. It's better you use GameState for multicast
How do I get the local player controller on a listening server? There's some confusing answers through Google (and most are quite old)
@soft shell the UGameInstance::GetFirstLocalPlayerController will return the local player controller even in a listen server
(or GetPlayerController(0) )node if you're in blueprint)
does anyone know if GameSpark still works? Im trying to run the sample project from the SDK but it doesn't compile, and the plugin is only available for version up to4.18
has it been deprecated?
Good morning. Does anyone know why the second (controller 1) pawn on a client wouldn't be able to call a RunOnServer event?
Cheers.
Depends on the actor
Ticking itself should be the server performance
Actual updates depend on actor rep frequency
It would seem to me that additional local players can't call RunOnServer events... Could it be because they're not owned by the client even though PlayerController 0 is?
Which class are the events running in ?
A pawn.
Is the pawn possessed by that player ?
Yes. Its local role is AutonomousProxy and it is locally controlled by a controller that I spawned on the client using CreatePlayer.
Ah, here's your issue then
I'm bamboozled. I can't seem to find the di--
Controllers should be on server
And replicated to clients
Player controllers are created by default really, there is no need to create new ones
Usually, yes, but to add more local players, one must use CreatePlayer, no?
Why would you add more local players ?
So I can allow four people to play on two computers.
Okay
No idea how to approach that, to be honest ; I don't think the network model supports that
Controllers need to be created on server to have network capabilities, in any case
That's a given
Whether you can have mutliple PCs per machine, i don't know
It's worked surprisingly easily so far. I can spawn an additional local player on each machine and it replicates and it plays well with the networked players... It's just this issue with the RunOnServer event.
Local players created on your machine cannot replicate
Replication is server to clients only
So why does it function at all then?
Because I can spawn a pawn on the server and possess it with a controller that created on a client and I can then control that pawn, move it around, fire my lasers, and more. But I can't call a RunOnServer event.
Local players are client only by design, no actor created on a client can replicate
The pawn is a different story
If it's server created, you can play with it
It can replicate, etc
The reason you can't call RunOnServer is that the pawn is not owned by a replicating Player Controller
I say "a replicating PC" but I don't know if it's just that, or "the first local PC" or something like that, tbh
So your PC needs to be created on server
Through game mode
But then somehow I have to choose which client that controller replicates to...
Yes, which is why I said this is beyond my knowledge. I don't know if the gamplay framework supports it.
I'rm just telling you what I do know
I need access to an additional controller on each client. If I can't create that controller on the client then I need another way for it to "listen" for the second local player's gamepad.
Either that or maybe it'll only be the host that can add additional local players.
It definitely needs to be created on the host
Unless you just have one PC on each machine that handles two players somehow
Which is an ugly but safe workaround if you can't do better
UE4 is a centralized server-clients model, no networking happens between things not on the server
I accept that the controller must be made on the host. Does anything come to mind about having a controller that was created on the server listen for a gamepad connected to a client's machine?
Cause that's the missing link.
I keep seeing mentions of Rocket League apparently being an example of multiple players on each client.
That's the piece I don't have ! You should look into the game mode for the player controller login flow
If all else fails, the "one PC for two players" approach is ugly but safe
Or one replicated PC and a purely local PC, with the net one routing events for the other
Ah yeah... that second option sounds feasible.
Hi all, anyone know how i can host a real-time strategy game server. Should i use separate dedicated servers per map?.
An alike game is Rise of kingdoms where you can see all players base on the same map as a kingdom.
If I was doing it and couldn't get an additional network PC through game mode, I would create "player components" on the PC that each handle a player
Hm, I see.
But the first option of getting new replicated PC is likely very much possible, just painful to go through
I found a little history in this channel where eXi was talking about how there is code that might support this in the engine but even he hadn't explored it at that time.
Thanks for your time and suggestions, Stranger.
Hope you can crack it !
I have a Server Replicated function declared like this:
UFUNCTION(Server, Reliable)
void Server_ApplyDataFromClient(const FMyClientData& inData);
and I call it in BeginPlay on the client when it joins a listen server. But when the server receives it, the struct is empty (values are initialized instead of whatever I sent from the client)
Anyone ever had this problem?
nvm, figured it out. My variables in the struct didn't have UPROPERTY() on them... ugh
@rich ridge thanks a lot for this tip! I want to replicate what each player is holding, do you think I should do this in the game state and onRep find the local version of the character and update the item and this for every client?
Sorry bro my bad, GameState is not the right place to do multicast because client is not owner of GameState. You should do in PlayerController only. Extremely sorry for earlier reply , I totally overlooked the ownership of GameState
GameState can do a multicast
just fine
Multicast doesn't care for owner, it just has to be on a replicated to all actor on the server, which GameState is.
I meant clients can't do RPC to server using GameState, so it's better if all RPC stuffs are at single place
that is what PlayerController is for, Server/Client RPC's ๐
multicasts need to be elsewhere
@waxen socket @bitter oriole super interesting discussion you two had there earlier today, Flynn, let me know how that goes as I intended to also tackle some multple local players as well and would be good to have that over network too if possible.
No problem, Mjolnir, I'll be reporting back.
Hey, how do I make it so that others can see your torso/legs but you cannot?
wait
imma try owner no see for now
Hey Guys, I have a bit of a networking question. So I can play my game fine on my own machine, but when i have it on a lan server, I am unable to connect and I notice my firewall is blocking the traffic. The traffic it is making it to the server, but the firewall is blocking the broadcasted udp packet going to 255.255.255.255 so I am not really sure how I am supposed to handle this on the firewall side because it isn't a normal port forwarding rule. any suggestions?
@waxen socket I haven't read the whole conversation, but it sounds like you're trying to get multiple players locally on each client, AND have them all participating in the same game with the Server and all other Client machines with their multiple local players, correct? I have done exactly that thing with my Scooty Shooty game over LAN WiFi (null online subsystem).
I think the same thing can work over internet online subsystems without much change. i didn't have to change anything about the engine - it is able to do this out of the box.
I have successfully run 3 PCs with splitscreen 2-4 players on each, all in the same networked game on my home WiFi.
My only problem right now is that the Android version can no longer see the PC version's Sessions to be able to join them. That feature was working up until about a month ago when it inexplicably died.
@low obsidian Have you allowed it as an exception on the Firewall?
@fossil spoke Add what as an exception? Only broadcasted UDP packets coming from a lan IP? I think that will work if that is what you mean. I can try that out
No you need to add the game/server executable as an exception
hi guys, im having an issue where i called a custom event (not replicated) to add a widget to the viewport but the widget was added twice and on top of each other in both client and sever sides. Any help to fix this would be appreciate ๐
BeginPlay calls on every Instance of your character. Move it to a ClientRPC that calls on Possess or move the whole logic to your PlayerControllers BeginPlay and use "IsLocalPlayerController" to guard it off.
thanks for your help, i'll try and see if it works :v
awesome, i got it working with the "IsLocalPlayerController" node : )
How can I tell if I'm on a server or on a client, when breakpoint is triggered in the debugger?
Anyone here use a VPN to get around port forwarding/setting ports issues for a test server? Currently experimenting with this and just looking around to see if thereโs some others who know what to do to get it to work
Is there any way to send an RPC as soon as an actor becomes relevant?
Some kind of OnBecomeRelevant() event/function?
Think I might have found it
Anyone know if Seamless travel is needed for a game server on Amazon Gamelift?
@chilly mist check the Role of the actor you are debugging in
Seamless travel is never needed, since it only works when the server changes the level for already connected players
and if I call ServerTravel() on a server it works right? It's not only for Seamless travel
without any players
Seamless travel is the feature where already connected players have a smoother level switch when the server calls ServerTravel
ok thanks Stranger
@unkempt tiger BeginPlay() would be enough too probably
Actors don't exist if they aren't relevant, so any usual initialization function would suffice
Oh, I didn't realize BeginPlay is called on newly found actors once they become relevant
@peak star @lilac bear Hey guys, thanks for your interest.
What I've read now is that apparently if you use CreatePlayer to make extra player controllers on one map, then when you host or join a session, those player controllers will travel with you and be replicated properly.
Unfortunately, that solution means that in order to allow four player in any mixture of online and local co-op that includes at least one networked connection, you end up with a bunch of extra controllers which will all run their BeginPlay and etc.
So my hope is that there's some way to simulate the process that registers these extra controllers during travel and call it only when needed.
@waxen socket I didnt know that but yes it gets quite messy! To eliminate the mess we.have to make sure we know which things like player states etc call Beginplay and in what order compared to other things and if there is a delay possible.
I'll take messy if it works in the end.
Is it common to only check overlaps on the server? It seems like a good idea to me but I wanted to ask just in case.
Probably depends on the use case. Some games might have the client tell the server that they think they've overlapped something. Server does simpler vector math checks and performs whatever was needed if it overlapped.
I see. Thanks.
Probably just comes down to personal style and feel for the clients vs cheating potential.
I see a lot of cheating concerns when reading about multiplayer. But I figure for a co-op game it's much less of an issue.
From what I understand, pretty much most cheating can be solved by doing server side only checks for even things that clients call. Rare exceptions might be simple state changes like replicating a bool for crouching a character.
Hey guys! When I set my actors (I got like 200 of them at any time) to NetDormantAll and call FlushNetDormancy(), I hit an ensure that says:
ensureMsgf(Lhs.Array.Num() == Lhs.InitialNum, TEXT("Container has changed during ranged-for iteration!"))
With the following stack trace.
Can anyone help me understand what is happenening?
Flushing the dormancy, you mean?
yes
Yeah, it's happening in the same frame
I need to pass a few updates across to clients
Oh, wait. I set them to net dormant in the constructor
I just call FlushNetDormancy when I need to update a value
4.24
The workflow is correct, tho: FlushNetDormancy() -> Then make updates to replicated vars?
Correct
You also set NetDormancy to DormantAll in the constructor/BeginPlay(), I'm assuming?
its set in the constructor
thing is, something got removed from that array
or added whilst it was iterating
but what exact container
It's during the building of the consideration list for replication
I don't get this issue if I don't set dormancy
yeah so its the FNetworkObjectSet
As in if they remain awake, it's all fine and dandy
which is a TSet
trying to find what could change that set
during iteration
you aint doing any multithreading right
The save system plugin I'm using is. But That is only reading actor info and writing to a separate object.
can you type log LogNetDormancy verbose in the console
then get it to crash and show me the output log
ok
Do you use repgraph?
yey :)
Thanks again @meager spade, @rotund sapphire
I m working on a MOBA game, so let's assume 2 turrets were destroyed, and then one player disconnects, and in the meanwhile 2 more turrets got destroyed , then the player reconnects , so will player see 4 turrets destroyed and is automatically handles by networking framework, or do I need to write the logic to update the player once he reconnects.
My turret pawn is replicatable.
if you can replicate a boolean indicating the turret is dead, you can make it spawn in a dead state
So I do need to write the custom logic to handled connect and disconnect case.
if it's spawned by the server, or not netload on client, it will be gone (assuming it was destoyed, and not just marked as dead) when client reconnects
though you could also test it.
My turrets are indeed spawned by server
Ok so I m confused, when player reconnects, will server respawn the turret with values which server is having like dead, total damage etc
if it's not destroyed, it will be repolicated in the state that it already is in the server.
if it's dead on the server, it will be dead for connecting clients.
you cna spawn a dead turret instead of an alive one and forget about the states. it may look visually bad tho
if it's gone, it won't be replicated, and therefore.. client wont see it.
I m not destroying the turret pawn, actually maintaining it's state like alive, dead, partiallyDamaged
yeah, so if you have the state replicated
it will be.. that state.
alive, or dead, or partlydamaged. if that's what it is on the sevrer.
then just replicate its state and allow him to spawn on client in a dead state (using this initial replicated property)
So if this is case I should not worry about writing custom logic to handle connect or disconnect state
the only thing you may have to worry about, is if you're using OnRep functions to update stuff like effects
also dont forget to destroy dead turret, ti's eating up loads of precious resources while doing nothing
robert, you're wrong
yes
anyway
the only issue you may have, as i was saying, is if you use OnRep functions, to deal with sapwning effects, etc
i dunno if you're BP or C++
then you should ensure that the onrep functions are also called, on client side (without authority) in begin play, to ensure that any effects relying on state are updated, to replicated state
if you use then
they being called before beginplay afair
Makes sense
exactly, so you you need to ensure they're called to actually do what they're supposed to do.
it may be only with blueprints tho, this must be verified
Sure omega
Is it possible to limit RCP to just 2 specific clients? If player A and player B is having a fight, player C to Z should not need about it.
Sure
You can put the RPCs on client-owned actors like the player controller
Player A sends a "hit" RPC to server through controller A, server sends RPC to player B through controller B
Anybody know how to get OnlineSubsystemSteam to stop broadcasting that I'm playing my game? i.e. people don't get those popups?
Yeah I dug through the code looking for an option but that makes sense.
Hey ya'll - What and where is the proper way and place to do level transitions for multiplayer using blueprints?
I've been using a server RPC from the player controller to trigger a level event to 'Load Stream Level's
Anyone has any information on anti-cheats?
I'm wondering if I should be designing my networking a little differently (that is, no longer assume that you can "never trust the client" for some cases) if I'm going to be licensing an anti-cheat
It's also impossible for me to actually contact easy anti-cheat and ask them myself on the dedicated https://www.easy.ac/licensing/ URL, because I don't have a company website
And I'm greeted with this annoyance every time I try to submit a contact request
EAC is not going to be affordable if you're an individual
Oh? Is it very expensive?
if you have to ask the price, it usually means it's 5-6 digits
what the fuck
And yeah, any competitive multiplayer game should be completely defensive with all gameplay processed on the dedicated server, trusting nothing but heavily sanitized player input
Plus anticheat
That's why small indies don't do competitive multiplayer
... but I am
๐
Wait
Why do you need anti-cheat if you're processing the important stuff on the server?
How else can there be cheating?
you cant have everything server authoritive
you need a little client trust
else every single input would be delayed
Like bullet trace hits, because no animations on the server
and that is not good for competitive
But what if I'm doing predictions properly?
Like, I'm working hard on getting prediction to work nicely
You need anticheat for wall hacks and triggers
That's impsosible to rpevent on server
Tbh that I can code for on my own
I'm not sure what I can do about wallhacks though
No you can't.
Why not? I can give users a trust score and if I see that their response time / mouse movements are unnatural, reduce their score smartly. If the score is below a threshold, kick them
Client-side anti-cheat is fighting a client that has total control of the machine and a copy of your software running through a debugger. It's impossible, and it only works because extraordinarily obscure techniques are used to gain time and make cheat making unprofitable.
Triggers do not change mouse movement, they are undetectable
A good trigger is basically constant pro-player reaction time, without manual aim
You're correct, i can't handle those cases
Somehow I imagined the cheater waiting past a corner, in which case it was kind of measurable when the target is moving, but thats just one case in a pile I can't handle myself
You can't handle triggers or wallhacks without client-side anticheat, constant updates, a reliable banning system, etc. It's way more effort than most smaller indies can afford. That's why competitive shooters are rarely done by small indies.
That's on top of your battle-hardened paranoid dedicated server running on your personal servers
Are there no cheaper alternatives to EAC? Also, can you tell me where you learned it's priced at 5-6 digits?
I have no idea what the price is, I just have experience with "email us for a quote" businesses
Maybe it's just 4 digits
But it's not going to be $100 because no one has time to answer emails for that
About running on servers, why does the game have to run on my personal server?
Can I not practically/financially use AWS or something of the like?
anything that's $$$$D is manageable honestly
@unkempt tiger AWS is fine. Just not community servers.
Oh, yeah I'm not going to be supporting those
@meager spade do you have any information on how to license EAC?
nope
But EAC requiring a company should signal to you that it's not going to be cheap
Basically they don't do business with single devs
Yeah, I got the hint, it's quite a shitty way of communicating that approach from their side honestly..
You're not the audience
a lot of companies selling big tools (that are expensive) do it by a quote
cause quotes vary depending on factors (team size, game size, etc, etc)
Hell, UE3 was like that
Early days were like what, half a million dollars for the license ?
Unreal Engine 3?
hi everyone!
does anyone know if there's an event like 'OnBecomeRelevant' or something similar?
trying to figure out a way to run some stuff client side to set custom depth stencil and things relative to a player's team. map is pretty big, so stuff isn't always relevant.
very possible i'm just approaching this wrong too
Lol I just asked this some hours above
According to @chrome bay, @plain musk , BeginPlay should be enough
hmm... lemme try that out then
sure enough that works
so beginplay gets called even when the actor isn't relevant and the client doesn't know about it?
or does it get called once it is loaded onto the client?
Yeah, UE4 distinguishes "newly created actors" from "re-found actors", both call BeginPlay
Im not sure
not sure why i asked. simple print string test should tellme. lol
i'll come back with my findings
Let me know, i havent tested things mysel- yes, good
it gets called when they become relevant
it looks like it gets called every time they become relevant
yeah
so if you are outside the net cull distance, and step back in, it reruns
interesting
they never mention that stuff in rep tutorials
thanks for the help, by the way!
Anyone find that when using the lag emulation, lag spikes up dramatically (more than expected/specified)? I go from 10-20ms ping on LAN/PIE, to ~100ms in PIE w/ just 1ms lag emulation and no packet loss
Were trying to get multi user editing working dm me if you can help
Quick question-- does ReplicateMovement perform any kind of compensation or am I better off disabling it and handling it myself on a custom pawn?
During the lobby stage, there's list of actors I need to guarantee they have replicated for ALL players before allowing the server to call for a SeamlessTravel. What's a clean way to do this?
I can set a timer that does a UGameplayStatics::GetActorOfClass(WorldContextObject, NecessaryClassInstance) call every 200ms, but I'm looking for something better
gamemode persists the actors, they replicate all over again for clients
so it would have to be a very specialized case where that would matter @floral crow
usually in lobby stage, the players have more then enough to do for stuff to replicate over + few minutes ontop
The InGame depends on this PlayerData lookup table which is a replicated actor to initialize parts of the game
So I'm trying to create it during the lobby and make it persist after the travel
and it has to be valid on server only
Which I already achieved
for the game level to work
But sometimes it's just not enough time for the replication to happen, specially on lower bandwidth connections
creating different UX problems for players and such while in lobby is a different matter, but it doesn't affect travel
and unless you have a huge amount of data to replicate
bandwidth is almost never the problem
and it has to be valid on server only
It doesn't matter, as if a player fucks up their initialization to try to hack the game it's their problem. The server will initialize them correctly and just reject everything they ask as a client due to info mismatch
creating different UX problems for players and such while in lobby is a different matter, but it doesn't affect travel
@winged badger What do you mean?
well, the lobby UI is hardly going to show correct states before the actors replicate
bandwidth is almost never the problem
True, it's actually more of a problem on lower spec computers
This behavior/bug has only shown up in lower end hardware
but does the client have a replicated actor that persists pre travel? that doesn't matter for travel
it will still have it after travel
most replicated actors are less then few kilobytes
well, the lobby UI is hardly going to show correct states before the actors replicate
@winged badger Yeah, I'd just have a loading screen until you have everything required
But then again same problem. How do I cleanly wait for everything I need to be replicated
so add ready buttons
because the problem you're trying to solve also comes down to "how do i prevent server travel until my slowest player loads but doesn't have a chance to see or setup anything at all?"
most lobbies include some kind of setup
and most setups include a ready button
when all players are ready -> start game is enabled
True
But there're still some other actors not necessarily useful for the Lobby but if I spawn them there and have them travel to game instead instead, my game map initialization becomes soo much clean
Because I don't have to be chasing these replicated actors on >30 classes with nullchecks and timers that retry every .1 sec until the necessary objects are there
Does anyone know how to resolve the following? I am able to connect to the server and see the traffic going back and forth. This is between a windows machine and a linux machine. I tried to disable the firewall on windows and allow all traffic through ip tables as well on linux and it didn't seem to work. This is going through a network switch on the same subnet and doesnt hit the firewall. I tried hosting the server on windows localhost and that worked fine. I am not too sure what the issue is.
[930]LogOnlineSession: OSS: Join session: traveling to 192.168.100.16:7777
[930]LogBlueprintUserMessages: [BP_SurvivalGameInstance_C_2147482603] Successfully joined server!!!
[710]LogNet: Warning: UNetConnection::Tick: Connection TIMED OUT. Closing connection.. Elapsed: 20.01, Real: 20.01, Good: 20.01, DriverTime: 20.01, Threshold: 20.00, [UNetConnection] RemoteAddr: 192.168.100.16:7777, Name: SteamNetConnection_2147482532, Driver: PendingNetDriver SteamNetDriver_2147482533, IsServer: NO, PC: NULL, Owner: NULL, UniqueId: INVALID
[710]LogNet: Error: UEngine::BroadcastNetworkFailure: FailureType = ConnectionTimeout, ErrorString = UNetConnection::Tick: Connection TIMED OUT. Closing connection.. Elapsed: 20.01, Real: 20.01, Good: 20.01, DriverTime: 20.01, Threshold: 20.00, [UNetConnection] RemoteAddr: 192.168.100.16:7777, Name: SteamNetConnection_2147482532, Driver: PendingNetDriver SteamNetDriver_2147482533, IsServer: NO, PC: NULL, Owner: NULL, UniqueId: INVALID, Driver = PendingNetDriver SteamNetDriver_2147482533
[710]LogNet: Warning: Network Failure: PendingNetDriver[ConnectionTimeout]: UNetConnection::Tick: Connection TIMED OUT. Closing connection.. Elapsed: 20.01, Real: 20.01, Good: 20.01, DriverTime: 20.01, Threshold: 20.00, [UNetConnection] RemoteAddr: 192.168.100.16:7777, Name: SteamNetConnection_2147482532, Driver: PendingNetDriver SteamNetDriver_2147482533, IsServer: NO, PC: NULL, Owner: NULL, UniqueId: INVALID
@floral crow keep replication order dependency limited to two actors at the time and you're fine
also, all Actors loaded from package are loaded and NetAddressable immediately when the level is loaded, even before HandleSeamlessTravelPlayer is called
and GameState is a special case, if you are using AGameState, and not AGameStateBase, it will always have replicated by the time first Actor on client calls BeginPlay
@floral crow keep replication order dependency limited to two actors at the time and you're fine
@winged badger You'd say this is the cleanest approach, keep them in sort of a linked list approach
never ever design a system that requires 3+ separate spawned Actors to have replicated in order for it to start working
tweaking NetPriorities might help
but it can also fail in case of packet loss
so best not count on it for a production system its fine for prototypes
and it has a way to come back and bit you on the arse if you're not careful
when the game starts, Actors will replicate over in order of NetPriority
that would be the reason why PlayerState is never ready when Controller and Pawn first replicate, for example
@floral crow I have a game where a player "builds" a robot of many parts, which are all separate skeletal mesh actors. Basically what I did: Created a replicated Actor array, of every body part, then on client's OnRep for that array, I started a timer, which checks each actor in the replicated array, and until they are valid on the client, the robot does not do any setup.
So I'm running into an issue with replicating a tank turret rotation.
Two players:
A,B
A rotates -> rotation spazes out if relative rotation is negative in either axis.
B sees A rotation just fine.
What has me the most confused is clients see other clients rotation just fine. Just not their own
Please ping me if you have an idea. (works fine without networking so its not my math or rotation itself)
However, turning the whole actor (instead of turret) is just fine:
ANSWER: I had component replication turned on for the camera. This caused the spazzing out.
@glacial pollen I'm working on a game with a similar building mechanic. I suggest replicating the bare minimum state necessary. The tank turret direction should be derived from the view rotation and vehicle geometry. Of the players camera is quite offset, replicate a DesiredAimDirection that is used by all vehicle parts to calculate their own rotations instead.
Okay, i understand that now (edit)
anyone familiar with net dormancy?
if you have a playerstate that only updates values anywhere between a couple times a second to not at all for a minute or so, would it be better to turn the dormancy to dormant all and then just force net update each time the server sets the variable?
first time looking at the network profiler and got my waste down from 100 to 50 by doing this, but not sure if there's any repercussions to doing things this way
@glacial pollen that RPC should not be reliable, ever
sure they should
in fact it's the only way to send data to the server
character movement component does the exact same thing, just a lot more complex
Oh wait i misread it.
My bad.
Thought ir was server to client. Haha
๐คฆ
Had to save the village and open it so i could zoom in.
Image*
Is it possible to spawn replicated actor on server and 2 out of 10 clients? If bReplicated is true, it replicates to all 10 clients...
You just spawn it on the server and it will replicate to all.
you can override IsNetRelevantFor or use the replication graph
@plain musk actors that are awoken from dormancy send all of their properties again (including COND_Initial properties), so there's a good chance it's not worth it.
Especially for something like a PlayerState which has a lot of vars, sends to many client, and may change often.
Just drop the net update frequency to something like 1.f and make calls to ForceNetUpdate() when changing vars.
Hey Jambax. What's your opinion on only checking overlaps on server?
@chrome bay ahhh, perfect. i'll do that then. thanks!
@waxen socket Depends. If it only matters on Server, only makes sense to do it on server
Okay, thanks. I think it makes sense for my space shooter.
Getting this assert failed Assertion failed: NewHistoryCount < FSendingRepState::MAX_CHANGE_HISTORY [File:C:/UnrealEngine/UnrealEngine/Engine/Source/Runtime/Engine/Private/RepLayout.cpp] [Line: 1883]
for below code bool ATLPPlayerState::ReplicateSubobjects(UActorChannel* Channel, FOutBunch* Bunch, FReplicationFlags* RepFlags) { bool WroteSomething = Super::ReplicateSubobjects(Channel, Bunch, RepFlags); WroteSomething = Channel->ReplicateSubobject(ScoreboardModel, *Bunch, *RepFlags); return WroteSomething; }
if i comment this line, crash doesn't happen WroteSomething = Channel->ReplicateSubobject(ScoreboardModel, *Bunch, *RepFlags);
you must use |=
sorry i didn't understand
bWroteSomething |= Channel->ReplicateSubobject
ohh i should use bitwise or
@fleet raven Thanks brother, you spotted the issue, I couldn;t have found that and wasted a lot of time
Hi guys is there anyway to replicate physics handle ... for grabbing object?
When player grabbing something the other player keep see different location
you can override IsNetRelevantFor or use the replication graph
@fleet raven Thanks, it works beautifully!
Good afternoon. I'm seeing a lot of conflicting advice on projectile replication and I wanted to ask for guidance here.
My game is an old-school space shooter with slow-moving projectiles. Would you recommend that I replicate the projectiles and their movement, or spawn unreplicated projectiles on each client and only run gameplay-related functions on the server's projectile?
Any advice would be appreciated. Cheers.
@waxen socket it's always good to spawn projectile on server
And thus replication is automatically handled
But if all I need to replicate is the spawn location, couldn't I just spawn it again on each client, send it flying at the same speed, and only check for overlaps on the server? Thus saving all the bandwidth of replicating movement?
@waxen socket I suppose an approach like that could work, are you concerned about how your projectile quantity will handle scaling up? Perhaps you can just lower priority for your (in-flight) projectile updates and use some sort of smoothing, I would imagine you could get your network performance pretty tight with some optimizations in the future.
I'm only worried I'm missing something in my understanding of replication. Suddenly, I'm questioning why we replicate such predictable movement at all. If something moves in a straight line at a constant speed, why bother replicating that?
That is an interesting question, and I think this is an optimization problem. For example if you have a projectile that travels in a straight line with a constant velocity then there is no need to spam location updates every tick except for when the projectile collides with something. I think maybe we should instead ask if UE4's projectile replication is smart enough (or has a feature) that can realize this scenario and optimize out these predictable movements. If not, this is such a common case that I'm sure there is a way to extend this sort of functionality into the existing system.
for a projectile travelling at constant speed in same direction, there is no need for additional prediction code
only thing client needs to know is where its starts, and its velocity
the prediction comes into play when something is hit, as its possible for client to hit something when the server didn't
but generally, you'd want overlaps on clients as well, as there is more to creating a proper feedback that something was hit then just inflicting damage
@winged badger @waxen socket I agree with your basis Zlo, to clarify further, when I say prediction it would be for more complex cases where something doesn't go in a straight line or predictable path (ie homing missile or something).
I can't prove, but I would be surprised, if the UE4 devs put in the projectile movement component and this wasn't one of the first cases they wanted to solve for (straight line constant velocity projectiles with network replication being efficient by only sending network updates on collision/overlap events) and so I suspect Flynn should not need to worry about this.
They probably don't even worry about it for the what, maybe 100 bytes per projectile it saves?
@dark edge, well, that depends on how shmup (re: bullet spamming) you are doing ๐
You still probably send more bites in the spawn and initialization phase then you do an update, unless the projectiles last for a very long time
correct, Flynn is working with slow moving projectiles in this case
@winged badger for something like that you should be doing a quasi ECS approach with data only and one central update function
i am strong supporter of approach where you simulate on clients everything you can get away with
instead of replicating it
Thanks for your help, guys. Zlo, you believe in checking overlaps on clients?
I got projectiles working as a pool of strucks and a subsystem iterating over them and it works beautiful.
how are you going to have a hit effect reaction on animation, blood splatter particles... etc
timed exactly right if you wait for an RPC/replication back
that you do on overlap on clients, independently
@winged badger oh for sure, In my vehicle game I don't even replicate any of the drivetrain state besides gear selection. The end result (movement) is replicated
Oh... hm.
in case of owning clients, inflicting predicted damage locally also doesn't suck
makes the game feel more responsive
I'm basing a lot of my thoughts today on an old post from eXi where he said "... don't replicate the movement. As long as the server calculates the correct projectile and damage, it isn't important if one client saw something a bit different"
i have a 8 player coop with isometric camera, and i do have weapons with 2000 RPM
So that's where I started questioning.
i don't care if one client sees a miss where server registered a hit
as there is just too many bullets flying around for that to be a problem
owning client will always see his hits correctly, as it has auth over them
right off the bat, I think the key with eXi's response may be high velocity, if things are moving so fast you could probably get away with some of that especially if you have high volumes of projectiles ie Zlo's case
I expect to have up to 100 projectiles on screen at once. Shared between four players.
but all clients know about simulated proxies is - FireButton pressed/not, Target, FiringMode, where the mouse projected to world is
clients roll weapon spread for simulated proxies independently, and its fine
didn't have a single complaint about that during open alpha
basically - as long as server is able to keep the true state of the game, and clients can't notice discrepancies
you're fine
and a client state that is slightly off, but game feels more responsive is better then when client has completely accurate state but has to wait for a lags worth of roundtrip to get proper feedback
@winged badger good perspective from a vet, thanks!
There's a lot to take in here for a novice.
We should only replicate the starting and hit position for slow projectiles?
We should check for overlaps on clients in order to play impact effects immediately?
What if the overlap never happens on the server? Do I still award a point and destroy the hit object?
My amateur two cents:
Not sure I follow your last question. For purposes of cheating the server is authoritative so unless the server sees the overlap then no points would be scored via gamemode/gamestate. In the case of non-replicated projectiles, the client and server would both be spawning on their own but only the server's overlaps would be counted. Note this approach should only be used for when projectiles move fast enough (or in large enough quantities) that they cannot be perceived to be out of sync due to all the activity.
It's just Zlo mentioned that he checks overlaps on clients in order to trigger blood and etc. without delay.
hey so I've got a really weird problem.
the listen server's character
you can't see the listen server's character look up or down
just side to side?
right, for checking overlaps on Client it would be a case of visuals only, so once again in the case of bullet spamming quantities that are very large (Zlo's 2000RPM projectiles) or so fast that a trace could be performed on server to get "close enough" you would have the clients non-replicated projectiles trigger an overlap for the purposes of effects.
@feral root That sounds nuts lol not sure what to say there. May need more info on your setup :S
And if the overlap never happens on the server? Did I just spawn the impact effects for nothing?
unfortunately yes ๐ if you see too much of that then you are on one of those edge cases I mentioned above's threshold ๐
you would need to rethink your approach by tweaking things... maybe firing more projectiles to hide it, or reduce fire speed enough that replication is an acceptable approach.
Hey everyone, is there a good way to go about character rotation replication?
In my game, the controller is set to game and UI -- I want to be able to rotate the camera (axis turn) independently of character rotation (i have an axis binding called rotate). The problem is, I can't seem to replicate rotation unless i use one of the bools such as Use Controller Rotation Yaw, but then I'm locked to the camera rotation / turn axis mapping. When I tried to make the rotate event toggle Use Controller Rotation Yaw on and off, it didn't work either so the rotation wouldn't replicate.
Any suggestions?
You should aim to decouple controller and player rotations by using two separate variables, and network only the character rotation
Anyone getting jittering on 4.25 when using Linear smoothing on the CMC? Not getting it with Exponential
@feral root use GetBaseAimRotation on the pawn
and get the pitch from there in your animation
@stone shore why would the camera ever be replicated?
you can seperate the camera from the player (so camera only rotates, and pawn rotates using other means)
@meager spade What do you mean by separating the two? The camera isn't replicated (unless I'm going crazy) the problem I'm having is if I want to rotate the player while they're standing still it seems I need to use the Use Controller Rotation Yaw option. But by doing that the camera is locked into position behind the player. If I turn it off I can then rotate the camera but not the player.
How can I separate the two? If I use something like adding local rotation to the actor it seems very choppy.
Im trying to implement a function from steam that pings a server to allow me to connect to it following this thread
Hello there,
I am using Steam for multiplayer, so I can easily browse and connect to my dedicated servers using the Steam server browser or my in-game
the problem is, the function "inet_addr" doesnt exist
also i cant get info from the callback because it is a ref
can some one help?
I'm having an error in the log:
LogNetTraffic: Error: UActorChannel::ReadContentBlockHeader: Sub-object not in parent actor.
I looked around on this Discord and found some discussions on this a year ago. I'm doing something very similar, which is trying to move a subobject from a component to an actor, in multiplayer. Things also seem to be working correctly when the error's logged.
I wonder if anyone's having more insights on this lately?
I'm getting some insane tick times on my multiplayer game. The world is about 150 replicated chunk actors, which themselves have about 1000 runtime added components each. These components themselves have no replicated properties and all have tick disabled. Only the 9 surrounding chunks are being replicated to the client. This works fine when I'm only spawning the chunks surrounding the player, but testing it with all 150 world chunks spawned on the server, is causing crazy tick times, despite only 9 chunks being replicated. Does anyone know what this could be caused by, or what I can do to alleviate it? I get like 150fps without multiplayer.
my STAT net only shows 110 considered actors, I have to assume its related to the insane number of components each actor has. These components basically never update, is there some way to manually tell UE4 when they should replicate?
nothing comes to mind, maybe cull replication by distance? unreal has something for that
@limber gyro I'm using that, i'm only sending the 9 closest chunks
https://drive.google.com/file/d/12Ot7tH-h60VBEGDQ6F-MCwb46KDN4JyP/view?usp=sharing this is my ue4stats file, I'm not that familiar with these but I think it confirms its the consider actor time thing
sorry man i cant help you much, the only optimisation i have done was with shaders and level streaming
your question is better suited for one of the big boys here
I'm having a problem where NPC weapon collision overlaps with the client controlled pawns stop working when the listen server host's pawn moves far away.
The weapon collision sphere is socketed to its parent skeletal mesh component, and is AI controlled. The attack animation moves that collision sphere through the player pawn capsule. The attacking AI controlled pawn and player controlled pawns are both marked as AlwaysRelevant. Everything works well when host is nearby, so I don't suspect any issue with collision profiles. The overlap event uses a switch has authority so detected collisions are only processed by the server (the collision-with-client-pawn event never even fires on the server when the server's pawn is far away).
After a few days of troubleshooting I found that re-parenting the collision sphere to the AI pawn's root capsule component (so that it is NOT socketed and does NOT depend on being moved by the animation) and resizing it to cover the entire attack space fixes the problem. However, this is not ideal because it doesn't accurately represent weapon collision.
Based on this, I suspect the problem is that when the server is far away, it decides that in the server's game instance it no longer needs to drive the movement of the child collision sphere with the skeletal mesh's animation (but I think the animation is still playing on the server, because the anim notifies fire, and the collision sphere still exists because it fires the overlap event when it hits other objects).
After a couple days of troubleshooting I feel like I've exhausted all of my options. Does anyone know how to get server side detection of skeletal mesh animation driven collision volumes to work when the listen server's host player is far away from the event?
does any 1 have any experience connecting to dedicated serves with steam integrated? i followed a forum thread that said i had to ping the server first and then connect with the server ID but the server never responds and i dont know why
what forum thread? @limber gyro
@meager spade huh, so there's another built-in rotation beyond ControlRotation? Never knew that lol
You can add camera yaw separate to pawn yaw
It's not replicated tho.
Nor should camera be replicated
Anyone got any good resources on the Network Profiler. I'm trying to work out if my capture is stupidly high or not.
I've found this https://docs.unrealengine.com/en-US/Gameplay/Tools/NetworkProfiler/index.html but it doesn't teach me how I should be digesting the output
Tool for displaying network traffic and performance information captured at runtime.
well after much beating of my head on a wall, I still can't get my Actors to attachToComponent() on Client whenever this function is called from a server-only function. However, it works if I perform this inside a NetMulticast... sorry @meager spade I feel like I'm letting you down after you told me this function would be replicated thus no need to call on clients.
I tried to replicate this same behavior from BP on the BeginPlay function and sure enough I have the same problem with only performing the attach on the server.
Attaching an actor (i.e. the root component) to something is already replicated if you have Replicate Movement checked.