#multiplayer
1 messages · Page 426 of 1
hello, if i have an array of objects which are replicated from server to the client
changing the attribute in one of the elements of that array won't trigger "on rep notify" call for that array
true or false?
changing something inside the element won't change the pointer, so no, it won't trigger the replication at all iirc
makes sense
don't like it though
i could make it so that the object attributes themselves replicate, but then i run into another set of problems
prolly gonna have to go with the RPC, to have a finer control over it
@winged badger sorry i dont really understand what you mean by it
I'm getting MaterialInstanceDynamic [npc.mesh.materialinstancedynamic] NOT Supported spammed in my dedicated server's log file. The Material is set during construction script.
Should dynamic materials be set remote only via switch has authority? To add - every time a player joins the game, it will spam this for each npc.
Hi so ive setup a simple cast to my player controller and on client side its allright but on server side the cast is failing? Im using the get controller node and its a listen server.
@winged badger @thorn yarrow yeah so it didnt work
Which is super strange actually
Even some of my units which I "own" by calling SetOwner() and then adding them to the array of "UnitsWeOwn"
They still go out of relevancy distance.
@fleet viper can you post your code/nodes?
@twin juniper have you tried stepping through IsNetRelevantFor?
looks like it is never called
@thorn yarrow It is never called on either the structure class or the unit class.
well, you can always type log lognet veryverbose
into your console
and see whats going on there step by step
warning tho: there will be many many many steps
@winged badger like this? -log lognet veryverbose
thanks, tho I can't see where you're checking if its server
can you show that part?
in any case, odd, controller should be available on server
also, when is this event called?
@twin juniper press tilde and type when the game/editor is running
same as if you were tying stat UNIT
@fleet viper and how far does the code go on the server, did you set breakpoints or simple print strings to see what part it reaches? perhaps it never gets to the cast on server
btw @winged badger how did you mean the logic behind the marker and how not to spawn them for desired clients?
if you're not using c++ you might be stuck hiding it
but even then its not that complicated
you have to have TeamIDs to have teams
so when you spawn a MarkerBP for a Team, you feed it TeamID at construction
@fluid flower it gets to the cast node when i press spot on the client window everything is fine but on the server window it goes to cast failed execution pin
variable - editable, exposed on spawn, replicated
@winged badger does team id also count like an enum TeamA and TeamB?
sure
then i already have an id
enum is a integer between 0 and 255 behind the hood
so but idk how to set it properly up im not really good at c++
so you spawn it on server, feed it teamID
now you need a way to grab the ID of the local PlayerController
im atm on it with oz
so on BeginPlay if TeamID of the Marker doesn't match the TeamID of the local PC
you hide it
my biggest problem atm is that my server isnt able to get the controller
because its a listen server
dedicated server would actually be trickier
i don't like using GetPlayerController[0]
but that shoul;d work with listen servers
you can also cache the TeamID on GameInstance as soon as its replicated down to clients
then you can get the TeamID of local controller without getting the local controller
can i even use player controller node? because of the index?
i am not 100% if there is an edge case or not with seamless travel and listen server where GetPlayerController[0] won't return the local PC
but barring that, on listen server, one at index 0 will be local, and on clients one with index 0 will be the only one, so its once again, local
will try it
using it on dedicated server, however
where there is no local controller
is a good recipe for a disaster 😄
heard a lot about it
anyway works perfectly
you said hide it but can i even be able to not spawn them to not desired players?
that is net relevancy
and you would need to go to c++ for that
there is AActor::IsNEtRelevantFor function
which you could override so it compares the ID of the marker with ID of the Controller
controller being the parameter called RealViewer in that function
and use that for net relevancy
i guess i have to learn a lot about networking in bps
if that function returns false, the Actor will not replicate for that Player
with listen servers however, even with relavancy
you would have to hide it for the host if it belongs to other team
as everything exists on the server
yeah
not sure why but the marker isnt hidden for enemy team anything i did here wrong?
@winged badger
That function seems broken in many ways. It never calls IsNetRelevantFor @winged badger
show me your function in the header @twin juniper
@winged badger yeah sorry, I was going to do that earlier but I went out. I'm going to try it now.
When the host of a match starts the game, they can't see the nametags or score tags of any player including themselves in the first round. After everyone respawns, they can see it. I have printed string to check if the nametag has a null input and it doesnt. This is what I do for my score and nametag: https://gyazo.com/96e41d371c837ff73786594776de8689 and I set the var in event possessed: https://gyazo.com/9c477a04e5c06c3bef79629ccd5b24c4 All that code is done in my character bp and in the widgets, I do this: https://gyazo.com/e066db9c2a7f83706a4bc5008638f60d (the variable is replicated). What should I do to make the host see tags in the first round?
@copper portal I am running into the same problem so if you find out let me know and if I find out I will let you know.
k
@strong abyss are you using the steam subsystem?
Yeah
@strong abyss ok I just noticed something. When the game starts the tags show up but they get removed for some reason
im checking the begin play on my level and so far it may or not be me setting the transform of the location
im using paper2d btw
I think it has to do with possess node on my end.
@winged badger I ended up checking it, looks like it's never called
time to ask, is the Unit Actor replicated?
yea
@winged badger maybe this would be a better question. How do I make an actor AlwaysRelevant to it's owner, but other actors follow the natural relevancy rules... NetCullDistanceSquared...etc
The owner of all units and structures is set to the player who spawned it and it's playercontroller. So if you spawned it, your player controller would be the owner.
Does that make sense? @winged badger
bool AActor::HasNetOwner() const
{
if (Owner == NULL)
{
// all basic AActors are unable to call RPCs without special AActors as their owners (ie APlayerController)
return false;
}
// Find the topmost actor in this owner chain
AActor* TopOwner = NULL;
for (TopOwner = Owner; TopOwner->Owner; TopOwner = TopOwner->Owner)
{
}
return TopOwner->HasNetOwner();
}
PlayerControllers override that function to just return true
and you can also check the Owner
make sure
@winged badger what would that do though
I know it has an owner because right after I spawn the actor I write SetOwner(MyplayerController);
bool AUnit::HasNetOwner() const
{
return Super::HasNetOwner();
}
const AActor* AUnit::GetNetOwner() const
{
if (IsValid(GetOwner()))
{
return GetOwner();
}
return Super::GetNetOwner();
}```
I put breakpoints on both of these functions and neither of these are called on the server either.
don't think engine calls those on its own
those are there for if you want to check if RPC can be sent
@winged badger i just figured it out the ReplicationGraph plugin messed it up.
I tdisabled the replication graph, and now my code works perfectly fine.
@twin juniper just cheaper checks first
you don't need if (UnitsWeOwn.Contains(this)) for example, if you set the owner
cheaper to do if (GetOwner() == RealViewer)
and effect is the same
true
Can somebody help me?
I want to implement a network layer for player login, chat, friend list, shop, etc... real time
Can I use GameSparks for it? is there a better product for that?
Heya all! A quick word for anyone interested in using SpatialOS. We wanted to let you know that we have just launched our Game Development Kit for Unreal. This package helps you scale your game’s resources beyond a single server while using Unreal’s familiar workflows and built-in replication features. If you want more information, head over to our blog post (http://bit.ly/2SyqdpZ) for an in-depth technical look at what the GDK can do right now.
@torn current Did you all fix up your pricing page? So we can calculate/estimate realistically? Also, are there real-world examples for pricing (current games out in the market using SpatialOS) ?
Hmm, quick glance. Guess not.
Hey @wary willow, we're working on clarification around our pricing and should have more info on this in the next few months. This will hopefully also include proper examples and cost projections. We can discuss pricing in more detail with 1:1 conversations, however, where we have more context about your game, if that helps?
? That's what the other guy said 9 months ago
@wary willow, totally understand it's taking a bit of time to nail down (and I can appreciate the frustration and curiosity around it!) but it's something we want to get right for our devs and therefore worth spending the time on.
Very happy to answer any more in-depth question via DM though if I can help further?
Wait, it works alongside normal unreal networking?
thats amazing
so i can develop a coop rpg multiplayer and use that to make it into an actual mmo
now thats cool as hell
What if the said 1000 players were in the same server and in such a small zone though? @torn current
Surely a multiserver system would work (Blizzard already proves that with WoW) but their server can contain up to 80 -barely-.
80 that is communicating with each other, such as in a big war zone. And WoW is only almost-stable when 40 people are around max.
Yeah but the thing is..
How much money is it costing you
And will you be able to monetize your game properly to cover those costs plus other devs costs, plus life costs 😃
Look at the ones currently out in the market
They are doing very bad financially so far, and most of them got a helping hand by SpatialOS themselves (maybe still are)
Well, if you really want a multiserver support for your game, you really need to have the budget to make a big game. 🤔
How do you budget for something with unknown pricing? 🤔
By expecting the worst? x3
Hah
I suppose that's one way to do it.
But
That's not easy to even do with their current pricing model.
Which is my point
This is something they keep talking about...but... somehow keep forgetting to do
And here: https://improbable.io/games/pricing
There are four ways to get billed
Tech is great. Hands down.
neat
It's the other part that you have be careful about
Well, player activity one seems to be the one that makes sense, if you want to make an UBER AMAZING HAX WOW KILLER GUARANTEED MMORPG.
Right, that's something you can somewhat easily budget for
Probably during testing, figure out your max workers
But, the sort-of unknown factor really, is what bothers me the most
Any/all of those number can easily fluctuate and we don't even know the hard numbers per type
I don't think they are wrong about "need to talk private yo" part. They can't really say anything without what you are planning to do.
That's not true at all
Oh.
well
you probably pay for server load
Is this on some sort of scale?
so understanding how your server loads whatever container you are using
If you make more money, do they charge you more?
is a major part of factoring the cost
Like, those little details...
I think that's what they would do, if you choose the "player activity" one, the 4th one.
And they have real-world examples out there they can at the very least... give us data on
How much is it costing Game ABC on Steam to keep running
@earnest comet chooose?
You pay for all 4
i dont there there is a game on steam running spatial
There are
Waaaaaaaaaaaait a minute.
er, ue4 game on steam
At least two games
sorryt
You gotta be kidding me.
yeah, both on unity
Hah, nah, you get billed for all four
but, yeah, it's not really priced for low budget indies
I've tried talking to them a few times about pricing
Because TBH...if given enough time...any indie with SpatialOS and some scope, can do something amazing with it
Excuse me sir while I am opening my wings and flapping my way out of the window and reach the sky, the stars, and hopefully God to ask questions.
Yeah, but then, wouldn't a big company handles those server stuff themselves to cut budgets?
But, if the costs are going to be way above what they can afford, no point
Exactly
Bigger companies will usually just do their down server arch
They are definitely somehow catering for smaller indies though
Because there's at least one dude that is solo dev
And has a game out
(with SpatialOS)
But, he's not doing so well financially
i do not think large game companies will do server arch like this
Well is there REALLY a point of NOT catering to indies? As we said, a big company will handle those stuff themselves.
Which is why knowing more information ahead of time is important
MMO-level tech is absurdly expensive to develop
Blizzard has probably spent well over 200 million over the entire lifecycle of wow for their server infrastructure
Not to mention that they connected servers to each other with uncountable ways.
But then, I hope someone uses SpatialOs to make an MMO-ish Dark Souls. 😛
AFAIK, no "real big studio" is using SpatialOS
Mostly small studios (talking 20 or lower on staff)
I am sure that would be a good win for those.
Until they become big, if ever.
Time is money, and all that shizzle.
Clinton Crumper, SCAD grad
Lot of good faces there
Still, that's only 19 people
I wouldn't consider that large
Larger than most Indies here probably
Most indies here are never going to need more than one dedicated server
Eh, depends on project/scope
You'd need a few thousands units sold to fill up a server
Realistically, that's not that many people
IMHO, people who really do need something like Spatial (as in couldn't work well with base UE) are very, very few
I wonder how Rare has been approaching their MP setup, tech-wise. It's an instanced MMO with smooth migration between servers on UE4
@bitter oriole Sea of Thieves ?
Yeah
In terms of handling MP, I think they've got the model right, even though the game is clearly geared toward not meeting people all the time
You can play all day long without interruption or loading screens, people come and go smoothly
I really wonder how close to the base engine they are
Hey
When the host of a match starts the game, they can't see the nametags or score tags of any player including themselves in the first round. After everyone respawns, they can see it. I have printed string to check if the nametag has a null input and it doesnt. This is what I do for my score and nametag: https://gyazo.com/96e41d371c837ff73786594776de8689 and I set the var in event possessed: https://gyazo.com/9c477a04e5c06c3bef79629ccd5b24c4 All that code is done in my character bp and in the widgets, I do this: https://gyazo.com/e066db9c2a7f83706a4bc5008638f60d (the variable is replicated). What should I do to make the host see tags in the first round?
Does anyone know if it is possible to replicate a “set text” call on a text render component? I have the component itself replicating just fine but when I call “Set Text” on the server it doesn’t replicate down to the clients, they just keep the default text. The only way I’ve been able to do it is with a multicast RPC which works fine, but seems unnecessary
Aybe you need a delay in there @copper portal if the name is updating aft3r the first death it's possible the value hasn't replicated yet before the function is called
@hasty adder good idea
yuck
@jade gazelle its possible to replicate a text variable (with Notify), then call SetText from its OnRep function
who is "they" in that story @copper portal ?
what creates the widget showing the names/scores, when and how?
Name tags tho tbh I get players states and gather the info from@th direct
@winged badger creation is in the code above and they is the hosts
I explained all of it
nope, you definitely did not
its a widget and the widget is shown using the widget component in my character bp
https://gyazo.com/96e41d371c837ff73786594776de8689 is the code for the onrep notify var in my char bp
https://gyazo.com/9c477a04e5c06c3bef79629ccd5b24c4 is how it gets set
https://gyazo.com/e066db9c2a7f83706a4bc5008638f60d is the binding code for the text in the widget
so why not push a Character reference into the widget directly
and then bind through that reference?
so u mean like no on rep notify?
no i mean
cuz I mean it works in standalone but not when I export to steam
instead of setting PlayerName
you Set a reference to PlayerCharacter
then you can access the variables inside the character
and if you are setting it too soon, it won't make a difference because the widget will catch up as soon as the variable changes
generally
directly updating UI is bad practice
you give UI a context
and let it take care of itself from there onwards
ok but then what would I need the rep notify for?
can someone help me im trying to replicate this to all players so in their screens is gona appear the information of the weapon
you couldn't need it at all
so I can just delete that?
the name would still need to be replicated tho
and btw, replicated variables inside anything UI related, including HUD do not replicate
oh
so I create a ref var in the widget bp and I cast to it in my character bp and set that var?
you don't really need a cast
you create a variable of your characterBP type
and just set it from your characterBP using "Self"
to the widget yes
k
but you would not need to cast the character
@sharp arrow what is MainHandWeapon there?
is an actor
is it replicated?
nop if i do that than the equip/unequip gets al screw
no replicated variable will replicate if an Actor its a member of is not replicating
is i could replicate it but if i do that and press equip it works but only sometimes
lets say if i press replicate
ill need to take out the multicast in equip/unequip and the variable nmeeds to be in not replicaated and i do that ops it works better but still has ltos of problems
if its replicated the one that is in purple was in multicast and i need to change it to not replicate if not it doesnt work not even a bit but still i get problems that sometimes you can see the player have hes weapon on the hand and sometimes no
@winged badger i dont think it worked
this is what I did in my widget https://gyazo.com/50013dc936269c26665abea47556e056
and instead of the rep notify in character, I did this: https://gyazo.com/67a34101b5f77bee7ec3790e2ec4b755
widgets are local only, always
so you can't really put the setting of the player reference behind an authority switch
o whait i think with authority it will work
begin play then?
BeginPlay would be far better
k
yeha it works ty
@winged badger it still doesnt work
now that you mention it, i also notice that PlayerName is no longer replicated
ye but I dont use that anymore
it was just getting set from the player name from player state
when I did have it
unless I do need to have it
put it back in and bind to it instead
no need
so only regular rep?
widget will not query it
whenever the function is called, which is every tick
im off to sleep, gl
k
i'm trying to get the shortest distance so i can tell an AI go to after whatever is closest
does anyone know how to do that?
basically i have anywhere from 1-4 survivors, and what i'm trying to do is get all of them and then check to see which is the closest
Hello! I am developing a network game. I had a problem with the identification of the player and accessing him to update his status both on the server and on the client
to be exact, I know about replications. But I can not make the desired structure
hullo everyone! does anybody have good sample projects for couch coop games like gauntlet or helldivers?
i'm working on getting a framework for such a game set up, but there are a surprising number of little issues with player spawning, control assignment, etc. i'm not sure how i'm going to make it so it works the same for multiple controllers on a single machine and for networked players
Anyone have experience with GameSparks? I'm trying to setup social authentication and am wondering if I have to run a webserver to handle the google/twitch/etc oAuth stuff
or is it possible to do just in UE?
any good tutorials to create multiplayer?
The Udemy course on UE4 MP
In this video we take a look at the finished project and step through each of the features that will be covered in this series. We show our functional Main M...
@signal marten Thanks
You got it 😃
so now i starting this tutorial https://youtu.be/lvbFrsL-f3A
---------------------------------------------------------------------------------------- 📖 This episode is our first iteration of the Chat Box UMG widgets. W...
hey guys do you know good c++ multiplayer tutorials ?
it is good to understand how it works in multiplayer
how do I send my own FUniqueNetIdRepl to GameModeBase::PreLogin?
actully I want to send PlayfabId instead
I wanted to use open server:port?id=PlayFabId on client side but maybe there is a better option
@winged badger Set Text —> Rep Notify works perfectly. Actually too perfectly and I’m not understanding how. Even when players log in after the rep notify function has been called they seem to have the correct Set Text info. How is that possible? If they weren’t online when the rep notify fired shouldn’t that event have never happened on their end? Or does it get queued and called when they connect to the server regardless of when the function initially fired?
when a new player joins the game, the replicated Actors will replicate to them
along with any replicated variables inside of them
which fires the RepNotify
Right, but with the text render component set to Replicate they don’t receive the correct text on their end. Only if I set it to rep notify.
So I’m assuming the rep notify gets fired individually for them on login?
doesn't matter if TextRenderComponent replicates or not
Well the text render component is a child of the character, which replicates
as long as its created during construction
So when it is created during construction, it is firing that notify function
setting something to Replicate doesn't mean that every variable and component is Replicated
I mean I can’t complain, it is working perfectly. I just thought I was going to have to add an additional function to retrieve the text nameplates of characters already on the server at the time of login
no, if it was created during runtime, and not replicated it would not even exist on clients
so new player joins
But they seem to be retrieving the correct info automatically once I set the function in rep notify
Actors that need to replicate to his Connection are evaluated
which is at this point, all of them
he receives a bunch, with instructions to spawn an Actor of a correct type, and specific FTransform
at this point client will run a construction script for the Actor
and create any components that come from the package (inside the Actor asset)
Following so far
after the Actor is spawned, client will start setting the values of its Replicated variables
that it received in that same bunch
each time a client receives a replicated variable it sets it on its side, then fires a RepNotify
including right after the spawning of the Actor
Ahhhhh I see. I was under the impression that the repnotify was like a multicast in the sense that it fires one time instantaneously and never again
it fires during intiial Actor replication for all Replicated variables
and then whenever the Server sets the variable on his side
even if its set to exact same value it had before
there is a blueprint caveat that doesn't apply in c++ network code
OnRep will also fire on the Server
So what I’m seeing is the first part of that. Even though the server hasn’t set the variable again when the new player joins, it is firing because t is being set locally on their client
after the variable is set
initial Actor replication bunch includes all replicated properties
so basically server assumes that client might not know their correct values, and sends them along with instructions on how to spawn the Actor
I think I’m understanding it now. Hadn’t used the rep notify stuff yet but now that I understand it a little better it seems like I will be getting a lot of use out of it
Can probably replace a lot of my multi casts
Thanks for the primer
one thing you should keep in mind
it raraly causes problems, but...
if you set a value of a replicated variable locally on client
OnRep will fire
its really not intuitive
so its hard to debug when it starts causing problems
if you don't know that
I’ll keep that in mind but for 99% of what I’m tying to make the server is handing everything and then just passing info down. There’s very little code that happens on the client other than Ui updates
Trying to keep it that way unless I absolutely have to do something on client
if you haven't already ran into it, i do recommend giving Cedrics Compendium a read
I’ve read it a few times now but every time I go over it a understand it better. The first time I read it I was just overwhelmed
Good to know that it’s still relevant though because I was worried some of the info may be outdated
Regarding the on rep firing locally. Couldn’t you just add a “Switch Has Authority” at the very beginning of the function and only use the authority branch? Then if it fired locally it wouldn’t do anything
that would stop it from performing its primary purpose
That..... makes sense, hah
as a callback after replication on clients
its generally not a big deal for most use cases
and the ReplicatedUsing in c++ doesn't have that... quirk
I’ll keep testing it tonight but for now it works great
Was able to completely eliminate some other code once I set it up
Hey ! I've a very strange bug !
I have override the TakeDamage function in C++ on my character and it works great.
But the "Event AnyDamage" in the blueprint doesn't work at all.
If the event in C++ works why the bp event doesn't work ?
The damage amount is not 0 and my collision preset is set correctly to "Pawn".
Thanks in advance for your help 😉
did you call the BlueprintImplementableEvent from your overriden function?
also, this is more #cpp stuff
Oh
Hi everyone :)
I have problems with replication (I guess) and I'm hoping someone can give me a little push :)
I store all my game data in GameState, which as far as I understand is fully replicated. I try to "channel" some of that data to the PlayerStates, by casting it from my GameMode to all Playerstates in a loop and modifying a variable in all those Playerstates. I have some success, but weirdly it seems that the PlayerStates on the client's side only refresh every 20-40 seconds. So the data definitely goes through, but what I really would like to achieve is to get the correct "up to date" data every time not just sometimes, if that makes sense :)
In my defense I am a game designer by trade with no programming background :p
I read Cedrics Compendium and it didn't help me with this issue so I guess by definition that makes me dumb, but not dumb enough to ask for help when I'm out of my depth :)
Could you please point me in the right direction?
Thank you in advance :)
@rose egret it is set to 100, still not good :(
@pliant cypress it depends on your ping and your actors
Anyone figure out the replication graph yet?
Documentation is kinda nonexistant and the stream they put out didnt help much
I got the general gist of it, but conceptually I'm missing a few things
I understand the point of replication graph is to move the replicated actor list building from a per connection build to a mostly universal list building so that connections share lists and they dont have to be built as often. Just confused as to how actors get assigned to spacialized nodes and how those lists are even sent to the client if they are at all
I have been pokin at it, but not yet. From what I quickly saw, they create a 2d spatialized graph. Which bounds are defined by the world size. (I wonder what it does with World Composition). From there, the ReplicationGraph.cpp converts their loation to a cell position (just a guess from what I remember from the livestream), and from there places it in the bucket associated with that cell. Likely connections are associated with buckets, thus, only actors in their cell/bucket is replicated to them, rest are likely dormant. I am sure they account for overlap som how but not 100% sure how, likely, connections can be associated with multiple buckets (cells). Just afaik, still learning it too. Anyone feel free to correct me. ^^
@burnt blade
Hello, is there a way to know when an actor becomes relevant to a client ? Like an event or something triggered, i've looked around and found nothing.
polling AActor::IsNetRelevantFor() doesn't seem right
that runs server only
you could override it to broadcast a delegate, but it would be received only on server
yeah that's pretty much what I want, that i know when the state changes
if its a debug thing, you could fire a Client RPC via RealViewer reference
so your client PC would be able to Print out which actor became relevant for it when it happens
you'd need to cache the relevant state, add the delegate (static would be best)
and broadcast it if the relevancy is different then cached state
far from elegant, btw
if you can override the function that calls IsNetRelevantFor
might be considerably less awkward
What is the best way to get a HUD element on screen in an online multiplayer game that reacts to the health of an actor?
I am having trouble getting it to work correctly with respawning enabled.
Right now, I have a health component on my pawns that broadcasts an event when the health is changed and have a bloody HUD overlay like in CoD4 that reacts to the event. So I have to bind and unbind the blood widget when the actor is possessed and unpossessed. But the HUD is created in the begin play of the playercontroller, which happens AFTER the possessed event is fired by the player pawn.
I've tried creating and destroying the widget as well, but it seems no matter what I do, I end up with some concurrency problems across the network.
use UMG
I am. Sorry for the confusion, my hud is made of UMG widgets, not the HUD base class.
ok then use a replicated variable for the health and delete all widget at death, re-add them on player possess
On player possesed is called by the server only right? So I need to call a method/event that replicates on the owning client from the on player posses that creates the widgets for the player character?
My pawn creates the widget on possession and destroys it on unpossessed.
My widget binds to the event on construct and unbinds on deconstruct.
But when the host respawns, the IsValid node where the breakpoint is fails because GetOwningPlayerPawn is returning null.
This doesn't happen when I hit play for the first time, it only happens after the host dies and respawns. The clients all work as expected.
@winged badger it still doesnt work
I have a question from someone, how can i get my live stream video to play when i am streaming on youtube, but on ue4?
So like, i stream on youtube live, and i want it to automaticly turn on my screen in level, within ue4
lol idk if thats possible, currently. or do i neeed to code something in?
you might be able to put a media player in the level and have it open a url. You'll have to try it to find out though.
Open Url
otherwise I wouldn't know of anything, that would just work
ight
Anyone know how I can pull players IP addresses through Blueprint?
the multiplayer shootout has that i think? at least it shows IP and player pc i think
at least from what i recall the server browser showed a bunch of numbers
I will take a look, Cheers
Doesn't seem so
Looks like there's just ping there
Need to grab the Player's external IP address
So it can be stored for a host migration system
1.I have a player when he equip weapon it only equipped on server but not on client and also itself
2.E.g Rifle is a separate blueprint which has skeletal mesh,socket name,relative transform
3.When i try to equip weapon from inventory it spawns an rifle actor and calls event on used which calls equip function (it is in player bp)
4.Everything works on server side but not on client side
I replicated actor , variables
Spawn an rifle actor on server
Has anyone had audio problems when trying to do multiplayer games? I noticed that in 3 players or more, various audio streams would get cut out for both local and remote (atteunated sounds). Would ShooterGame's LocalizedSound Cache system fix these problems?
Is there a way to replicate a variable inside of a UObject ? I'm getting unresolved external symbol errors when trying to set a UProperty as Replicated.
Yes there is but its not supported out of the box.
Google it, there are resources that explain how to achieve it.
i'm not stuck with a UObject i just need a replicated data container that can also have references in BP
Use an AInfo Actor
but I don't want it to be an actor or a component
....
can't a struct do it ?
Sure, but not natively inside an UObject
ok thanks
AActor is the first object in the heirarchy that supports Replication
Out of the box
I'm getting many errors trying to implement networking for the UObject the manual way
Fix them?
more like the replication functions that the scripts are supposed to call is not defined
from the wiki
Follow the tut man, its all there.
Is ```cpp
UPROPERTY(Replicated)
uint32 bReplicatedFlag:1;
necessary ?
Why is there no simple UReplicatedObject class ?
not according to this : https://wiki.unrealengine.com/Replication#Advanced:_Generic_replication_of_Actor_Subobjects
and why would you need to have something that can be placed in world when all you need is the data ?
There is literally a section "Actor Code For Subobject Support"
You can't replicate a UObject without an AActor
Because it's totally fine to use an AInfo Actor to replicate data if needed.
The Data doesn't have to be a class all the time
but if i'm already using an actor and I just want to send more data though a specific container ?
Structs
structs can't be referenced in BP tho
What do you want to achieve then? You can expose your Struct to BPs.
BP even support pass by reference for Structs by now
Basically what I want is to have a class that can store data and directly affect the world, and that can have reference to it
the problem with structs is that the reference can't be stored in a variable, as in 4.19.2
also they can't trigger any code by themselves
AActors have the problem that they are placed in world, so they are subject to culling distances
You can mark them as always relevant
Otherwise APlayerState, AGameMode and AGameState would suffer from the same
and UActorComponents have to attached to an actor, which makes them harder to access from a component
ok
It really only hurts your overall work process if you try to avoid Actors here
- you barely can, cause as said, even for Object Replication you need an Actor that actively replicates them
Dont try and fight the architecture honestly, just stick with how the engine wants you to manage it.
AActors are required for Replication
Use an AActor
basically what I'm trying to do is to use them to share data about groups of actors that are bundled together
I've already got AActors
I just need to share the data
so structs ?
Well anyways thanks a lot for your time
Usually you make a Manager Class that manages the Actors.
That Manager could be another Actor or a Component
The Component would usually be placed on either GameMode or GameState
And in their you can keep track of everything, like groups and such
GameState can have components ?
Sure
Oh
Every Actor Class can
well that simplifies a lot
(at least I'm not aware atm of any actor that can't)
Yes every Actor can
One last question : Do you know of an event that is triggered when an actor becomes relevant to a client ?
I've got data that require some heavy computations so using a RepNotify variable isn't really an option wince the data may be modified and discarding all previous computations would be a waste.
BeginPlay is called again when an Actor becomes Relevant again.
And EndPlay when stop being relevant ?
At BeginPlay, are all replicated variables set or is there a delay ?
The initial values should be set, but not sure
BeginPlay is not mentionned in that document
ok thanks a lot !
Can I make a donation or something ?
That saved me so much time
Don't worry
also the Network Compendium should be updated to include that
everyone needs to know this
What exactly?
That when an actor becomes relevant BeginPlay is called
Yeah, will have to add a good chunk of new info at some point. Sadly barely having time.
Is there a way to contribute to it ?
Nope. Back when I wrote it I didn't plan in contribution.
I would need to either rewrite it in GoogleDocs or put it up on some repo
but that takes even more time
yeah...
well you can have components and actors that are replicated
so that when they are on the server they are also on the clients
that's what you use for multiplayer
and it works thanks to replication
yep that's true but ECS works in more Architectural way of managing things than considering the more object oriented way that components in ue and actors are using
Hey, folks!
Introduction
In case you don't know what ECS is about: wiki (https://en.wikipedia.org/wiki/Entity–component–system), much more
UE hasn't got an ECS
that's a plugin
can't say anything about it since i'm not using it / the creator of it
Your better off asking the Author, i doubt anyone here right now would be able to comment on how it works.
what part of the rep system are you talking about ?
replication only copies data from the server to the clients
ok just hear me out
where all the data in clients are manipulated individually but together
without the multicast
can't tell without saying something wrong, my bet is as good as yours here
or is it that it already works in the same way
read the Network Compendium
Read the documentation mate....
ask the dev
or ask directly the question about the replication without comparing it to the ECS
How are we supposed to know how his system works.
Ask precisely what you want to know using only what is already in Unreal
For example : is the replication object-based ?
well like i said it more of an design question not a technical object oriented question per say
anyways thanks for answering mate
I'll try to get a better perspective on both aspects and maybe come with a more refined question.
Hey all,
So I want to spawn a particle effect on clients close to a projectile hit.
Which option (or other) do you prefer?
Option 1:
Server spawns a replicated actor with desired cull distance .
That actor spawn the particle on clients when replicated - within the cull distance.
Option 2:
The particle is spawned on Multicast.
Second seems less expensive
its not
It's more expensive to spawn independtly all particle in each clients than replicates one ? 😮
does anyone here have AdvancedSessions for 4.21? or maybe i should ask is it even released?
4.21 is still in preview or not?
Just wait till it's released. Then the plugin people usually start updating
Preview Engine Versions aren't production ready, so most people don't care
I never even touch them
it isn't in preview, it's released
to be frank i accidentally clicked the 4.21 branch instead of the 4.20 one and realised that after it had over half compiled so i thought i will just hang with it, but didn't know advanced sessions for 4.21 isn't out yet...
4.21 is not released o.o
how come that
It's in preview, as I said
on github it's just as any other version branch
Well, they probably don't mark it there. But they just released preview 4 a few days ago or so
and through how many previews does it usually go before it's released?
4 is usually quite high already, but nothing stops it from going 5 and 6
There are no rules
Epic uses the previews to let us find bugs and test stuff.
Then they fix them and at some point release the next preview or release it fully
then i'll just wait a few weeks until that plugin is released. i wanted to update our project to the latest version as we're still on 4.19 and it starts to suck
thanks
@stray ridge ive written an ECS plugin for unreal
works like a charm, fast as fuuck
but its not worth it
you completely lose blueprints, and of course all replication unless you do it yourself
and also, the "write back" from the ECS simulation into unreal will bottleneck real fast
the overwatch ECS netcode talk is amazing , from gdc paid vault
they made sure to have a fully deterministic simulation (much easier to do with ECS) and for prediction they just let the client simulate the game ahead of the server. When there is a mismatch, the client just recalculates the last N frames and lerps beetween the different states
Is the "Blueprint Multiplayer" tutorial playlist on Unreal's Youtube channel any good? Seems kinda long and I see a lot of comments saying its not done right. Just curious. I'm trying to setup my pregame lobby and was going to check it out.
if youre using advanced sessions plugin you can look at this one https://www.youtube.com/watch?v=rWs6SyyVpTE&index=1&list=PL3TrrCsmmxllnBvhucQ4c683a2VltXBx6
Setup everything to work with the Advanced Session Plugin: - (Install Visual Studio 2017) - Install Advanced Session Plugin to the Engine (4.18.1) https://fo...
@balmy kindle Awesome! Yea i am actually. Thanks
Is there a way to make "Network Relevancy" update instantly?
https://docs.unrealengine.com/en-US/Gameplay/Networking/Actors/ReplicationFlow
If we look at this, the issue is that every 1 second, relevancy is checked by calling IsNetRelevantFor(). This is fine. However, the part that is an issue is this:
For each sorted actor:
If the connection hasn't loaded the level this actor is in, close the channel (if any), and continue
Every 1 second, determine if actor is relevant to connection by calling AActor::IsNetRelevantFor
If not relevant for 5 seconds, close channel
If relevant and no channel is open, open one now
If at any point this connection is saturated```
We do NOT want a 5 second setup. Is there a way to change this timer to also be every 1 second? How do we change the network relevancy timers?
@thorn yarrow But is there a way to actually change the timer?
@winged badger u here?
How?
NetPriority = 1 = 1/1 = every second
NetPriority = 2 = 1/2 = every half second and so on @twin juniper
@thorn yarrow I have netpriority set to 3
okay
should update 3 times as fast, but again, not advised lol. if you want to dynamically change it, do that but would not suggest updating all your units 3 times a second all the time hehe
that is NetUpdateFrequency
NetPriority comes into play when there is more traffic then the capacity to relay it
"An Actor with a priority of 2.0 will be updated exactly twice as frequently as an Actor with priority 1.0."
seems it accomplishes ths same thing but sure
its just implicity vs explicity
the Actor with NetUpdateFrequency of 3 will be considered for replication 3 times per second, basically
Zlo, the problem still occurs. Ive also tried putting the cast and setting the ref in a run on owning client event but it still doesnt work
the idea behind giving UMG context is that once it has a reference, it can query all information it needs by itself
the pattern also allows for completely changing the UI without altering the underlying game code
you display the name via a bound function, correct?
it querries the information (PlayerName) every tick
k
if you want the UI to respond to some event, instead of querying it constantly, you use event dispatchers
the Pawn has a dispatcher, and calls it when something significant changes
and UI binds an event to that dispatcher, so it gets executed whenever Pawn calls it
now, WidgetDisplay components are a bit of special use case, in that the Actor owning them can reference the UI by default
in general, its best not to have your core code have any knowledge that the UI even exists
so if casting to the widget and setting the pawn var dont work, then I have to use event dispatchers?
you'd still need the pawn var to bind
you can have the widget display the pawn's displayname instead
to make sure the reference is set correctly
also when setting up a UI for the first time, you should have part of it clearly visible, no matter if it has context or binds correctly
you really don't want to go debugging the name, if you are not sure UI is even visible or in the right spot
well how can I make this work into the code that I have
when your WidgetDisplay has a Pawn refernce
and shows whatever is in PlayerName variable over Pawn's head
then you are done with the widget part, it works fine
then it becomes a matter of making sure that the PlayerName is current and correct
well why does it work when the player is recreated?
if there was exactly one way to recreate a player, i could answer that
I use spawnactor
but the playercontroller and playerstate are already around at that point?
ye
dunno if you can pull OnRep_PlayerState in BP
only if u create a playerstate var
?
have what
if the host gets recreated when the respawn happens and the nametags show, couldn't I just trigger that respawn event again?
got any code in that project?
only bp
where is your replicated name variable again?
character bp @winged badger
and it gets set when?
at BeginPlay just check for IsLocallyControlled
when you spawn the actor it'll get fired
the way i understand it its a name tag on widget display component that isn't supposed to be only local
widget are only local yeah
dunno didn't read everything above
IsLocallyControlled would be counter productive
check if it's not locally controlled then
@winged badger begin play
BeginPlay of?
and you don't have accessed null?
or have IsValid check for PS?
because on Characters BeginPlay PS won't be ready
not even on server
@solar halo you might get different results for that question asked in #multiplayer and anywhere else
difference being that PlayerState can (and by default does) persist after player loses connection
so for a multiplayer game, it has certain advantages
that other options do not
I usually do PS myself, but I'm just curious what people choose and why.
if you drop connection and rejoin, your PS is waiting for you
along with the Inventory
so results here will be biased towards the PS
I should've probably put in the question Multiplayer.
@solar halo The only reason to put those in the PS or the Character is if other people in the multiplayer server should have a reason to access whatever stuff you have in your inventory at any time. In my opinion, there's no much reason for that so I'd recommend just putting it in the PC and then if somebody needs to access it, you can have a serverside function/event in the PS to get another player's stuff.
@versed socket What's your reasoning behind Controller?
@solar halo The PC exists only on the server and on specific client. The player's inventory should only be relevant to those two in particular.
The PS & Character exist for everybody. If you make the inventory replicate through there, then not only does it add extra stuff to send over the network from the server to share with everybody else in the game but it also makes it so that anybody can see your inventory at all times directly. So why do it that way when you can just ask the server to tell you what's in a player's inventory? To me, it makes more sense for the server to tell you rather than to ask the other client directly.
@versed socket bOnlyRelevantToOwner would address that consideration
sorry i mean,COND_OWNERONLY
how do I sent my own UniqueNetId to server ? :(((
Hey I hope someone could help me.
I setted up my lobby and menu stuff as I planned to but I want to disable join even if there are spots left for players when the players travel from lobby to game
And just can't find much information on how to do that the only thing I find is that it's impossible on BP
Thx
Hi Guys, I have a sprint system with a variable CurrentSpeed being replicated. When I call StartSprinting, it calls SetSprinting(bool sprinting) and it will set the CurrentMoveSpeed variable on the server. After calling SetSprinting on the client, I check the value of CurrentMoveSpeed and it is still the default value. But when I call StopSprinting and do the similar logic, it gets the stamina boost. Does this happen because it doesn't wait for the server to execute the code so it just sets it to the value of the variable at the time of execution?
Hello, all. What does bReplicateMovement = true for APawn actually do? I have set my custom Pawn to bReplicates = true; bReplicateMovement = true, set its DefaultSceneRoot and SkeletalMesh to bReplicates = true, but it still does not update on clients. What am I missing?
After that, check the blueprint to make sure that Replicate Movement is true
@ocean dust UE wont set the checkbox to true if the blueprint is already created.
These are my settings atm
My projectiles replicate correctly with very similar settings. But the Projectiles use a ProjectileMovement component, which I'm guessing is a major difference
As my custom Pawns use physics forces to move them around
do you have a CMC on the pawn @ocean dust ?
pawns wont replicate movement by default, you will need to handle replicating a standard pawn
is it ok to use get player controller with an index of 0 in game instance?
@meager spade No, it's a custom Pawn class
Then what is the point of the "Replicate Movement" boolean?
What is that supposed to do?
Well, fantastic. Do you have any links handy for movement replication for custom Pawns?
Thanks for the heads up all the same
i think it just enabled the CMC to replicate movement
Why would that be on APawn and not on CMC?
Then again, given what I've learned about UE4, that's not so surprising
cause you dont need to use a CMC, any movement component can handle it
like ProjectileMovementComponent etc
and its not on APawn its on AActor
Why wouldn't that be on UMovementComponent, then?
And have those components inherit that?
Yeah, understood
cause the settings are not just for movement
Still doesn't make sense why it's a boolean on AActor that does nothing
Unless a MovementComponent is attached
which seems like it defeats the purpose of the Component-based approach
But I digress
thanks for the info
yeah so you will need a custom movement component for the pawn
or one of the premade ones
Sigh. Alright. Any links for such a thing?
Otherwise, I'll start digging through the docs/code
not sure if UPawnMovementComponent does replication
but looks like a good start to maybe replicate the movement
for most characters i just use ACharacter even for AI
but i know in the near future, i will be writing a custom movemement component for AI, because CMC is so bloated, 100+ AI and the bottleneck is the CMC
Yeah I'm learning that UE4 has a very specific and rigid expectation of how their game systems are meant to work
and if you stray from that structure, nothing works
yeah, trying to fight the engine will only dig you a deeper hole into the void
Starting to make me think I made a mistake picking UE4 for my game
well, UE4 is a good engine, i mean there are other engines out there, but UE4 can do basically anything you like but its a bit of a learning curve and its also learning how what and why things do what they do. Don't even get me started on the AI Percepetion system and the fights i had implementing new senses 😄
Yeah. I guess my thoughts are: I picked UE4 for its built-in replication and multiplayer abilities. But I'm learning that what I'm looking to do for my game does not fit with what UE4 was designed around, which means I need to implement most of the things I need.
I feel like if I have to jump through those hoops, put in all the effort to extend replication to other systems, learn how things work in UE4, why they don't work for my situation, and then crowbar them into place to work correctly
what are you trying to do with APawn?
that I might be able to spend my efforts more productively on an engine like Unity
hello active people im new to the discord where do i go for help with getting leaderboards to work for anroid ue4
Where the plugins are meant to be generic and the system as a whole is smaller and simpler
The APawn I'm trying to build has a few requirements:
1 Not a humanoid character
2 Moved by physics forces
3 Animated (but only a little, nothing big)
4 Replicated location and rotation
5 Attached static meshes
6 Can be spawned/respawned as a part of player death without destroying the PlayerController that owns it
As far as I have come to understand, #1 already screws what UE4 assumes
#4 is not done automatically, no matter how many checkboxes I click on
And it seems that #2 is going to require a lot of client prediction which is also not done out-of-the-box
I ran into other fun problems like "AActor is the root of replication by default"
u need a blueprint making for that?
Which means replicating things like Inventory items is stupid difficult and one has to go write their own UObject base class that supports replication
Assuming your Inventory items don't need a transform, gravity settings, scene components, etc. that comes along with the hugely-complex-but-somehow-still-lacking AActor class
</rant>
If anyone with a more intimate knowledge of replication in UE4 could help me out real quick that'd be cool. I have two players connecting to my game right now: Player 1 as the server, and Player 2 as a client. From the Player Character owned by the client's Controller (P2), I want to call a custom event located in the Player Character owned by the server's Player Controller (P1). Currently, the event runs only in the client's version of Player 1, but Player 1 does not receive the call server-side. Switching the event's replication mode to Run on Server produces a "No owning connection for actor" error, which I assume stems from the fact that the client's Player Controller does not have ownership over Player 1. Am I understanding this correctly? And how can I fix this? I feel like it's something simple I'm overlooking.
essentially, this is what I’d like to achieve
@gloomy flint P1 is not accessible by P2
your arrow from P2 to P1 is not possible
Clients cannot talk to each other
they must go through the server
You would want to create an event for P2 -> Server -> P1
Hm, okay. How would I go about doing that other than what I have, since P1 is the server?
You would create a Run On Server event that P2 can call
That will then forward the message on to P1
The Server has a reference to both Player Controllers
Each Client has a reference to its OWN Player Controller
But the Clients do not have access to other Client's Player Controllers
So your graph is incorrect
Okay, makes sense. Where would that Run on Server event typically be located, blueprint-wise?
It would probably be in the PlayerController, such that the P2(CLIENT) calls a Run on Server event on itself
That event will be dispatched to the server
Then the server can look up the other player controller
and send a Run on Owning Client event to the P1 PC
(or just a regular event, if you're expecting P1 to be a listen server)
Aha, okay, that was the issue. I had to set the custom event in P1's code to be Run on Owning Client
Thank you so much! I knew I was just mixed up somewhere.
Where SendMessageToPC is the event that is intended to run something on another PlayerController, but it actually is replicated to the server
Then the server-side forwards that message to the other PC
Gotcha. Thanks a bunch
👍
Any idea why this error comes up on shipping builds of my dedicated server? https://puu.sh/BVPYY/24ab63584a.png
Profile doesn't have it, only shipping. All ports forwarded too
Ok, so my Projectiles replicate correctly while my other Actors do not. HOWEVER it doesn't seem like ProjectileMovementComponent actually does any replication. I'm guessing the Projectiles only appear to replicate correctly because their ProjectileMovementComponent state is being set correctly when they are spawned, and it happens to "play out" the same on both client and server (but not actually synced)?
@hollow patrol Is another process already using that port?
Maybe an old instance of the dedicated server is still running?
hmm, when was NAT holepunching added? from 4.21 preview 4:
Fixed! UE-65576 STUN and TURN servers needs start scripts for first time users
I thought holepunching was subsystem-specific?
How can I call events from Player controlled pawns only if they're the locally controlled pawn?
Client RPC @solar flower
Show me what's before the branch
That's happening because the controller hasn't possessed the pawn at that point
You need to run that after being possessed
For the client, you use OnRep_Controller, for the server you use OnPossessed
It might be working in your tests, but in a real scenario it won't. Check the validity of the controller to see if you even have one when you are the server
This works 👍
For multiplayer shooting "projectile is best or line trace is best "give some suggestions
For network bandwidth
For rifle gun,m416 like
Only line trace can work with realistic bullets
Line trace make more bandwidth or projectile actor
Hello there !
I'm back with the problem we didn't resolve last time : LAN VOIP !
My colleague and I have been trying to establish VOIP from an empty project, adding everything you could have tell us previous time, without success.
Now the time urges as our project reaches the end and we REALLY need this functionality.
First of all, we tried ShooterGame VOIP which works fine !
Then we implemented our VOIP as follows :
In the PlayerController :
In the DefaultEngine.ini :
In the DefaultGame.ini :
This is what we think to be the minimum requirement to establish voice communication.
(We also tried with DefaultPlatformService=Steam without success either)
@ember jasper When you figure this out I absolutely want to know too
@versed socket Ahah, if we find it out, after all the time we've been searching for the answer, not only you will have your answer but we'll really consider making a proper video to not let anyone stuck into this again.
It'd be a real shame if we had to use a 3rd party VOIP software because we didn't manage to make it work on UE4.
Can anyone shed some light on this? When clients log in, there's some bugs that can arise before they get all the replicated data loaded in. I Managed to put a Get Players Array on the Game State, if it's > 0 then wait until it is, before allowing the player to load in. I also made a widget to access the Players Array and when I look at it as the Server, while the Client is logging in and loading data, it looks like a lot of the Server's variables are getting set on to the Client's Player State until they get their data loaded and then it shows them as the Player State default values that I've given it.... here's a screenshot:
^ that's what it looks like on the server when a client is logging in and not loaded yet
1 is server's character name, but the client is showing 0 for name even tho the other stats are all coming from the same Player Info struct I put on the player state
it actually still has that data until the player overwrites it with signing in to a character so maybe it's getting set in my save game or something
@winged badger r u able to help me?
Is there a standard way to shoot a ping to a specific IP address in UE4?
@mighty rover Don't know about a ping, but you can send an HTTP request: https://wiki.unrealengine.com/Http-requests
I got HTTP requests already sending to get public IP (using a public web service that simply returns your IP in a string, and I crawl the page to get that response). I'm trying to fake nat punchthrough via mobile on cellular networks in my p2p game by using GameSparks matchmaking and cloud code to send host the client IP and essentially let GameSparks do the handshake
would an HTTP request work in the same way for verifying client IP?
"verifying" in the loosest term possible lol
essentially all I'm wanting to do is send a quick ping of sorts to the client from the host to initiate some sort of basic communication between devices, then see if I can let GameSparks do the rest.
thinking about how nat/network works, a ping wouldn't give me that anyways. Nevermind
just need my host to try to send an outbound connection somehow to the client IP so it fails so that the reverse connection will be accepted.
@ember jasper The strange part is, that it's really not much work to get this working
Did you consider making an empty project and trying it in there first, to make sure it's not something random in yours?
And yes, I know ShooterGame worked for you, but to recreate it, it's maybe better to get rid of everything and just get voice to work first.
I only ever implemented this once and iirc I only added some cpp code to the PlayerController to start and stop talking
- the usual ini stuff
I have these custom events being called from a client pawn to a listen server pawn. They were working just fine but all of a sudden decided not to... I haven't changed anything about them or the two pawns' replication settings. Any ideas on where to poke around to get it to work again?
happen to me before i think it was not the blueprint, i just restarted the unreal and the steamvr driver
Always a good thing to try haha, I'll reboot it just in case. 😂
Unfortunately nothing 😦
Hey @thin stratus !
I'm glad to have you there once more ^^
Making an empty project is exactly what we've been doing here.
The only difference is : we didn't go through cpp.
We believe the only requirement in the PlayerController is the Sessions management and as illustrated above we implemented it in blueprint.
And the connection is correctly established.
But no voice communication.
Maybe we've been missing something that is implemented in cpp and not in our Blueprint ..? We're on 4.19.
Can't say anything about the Engine Version being at fault. The project is def not on 4.19 so it might be, but welp
;; EXTRA LOGS START
[Core.Log]
LogNet=verbose
LogOnline=verbose
LogVoice=verbose
;; EXTRA LOGS END
;; VOICE IMPLEMENTATION START
[Voice]
bEnabled=true
[/Script/Engine.GameSession]
bRequiresPushToTalk=true
;; VOICE IMPLEMENTATION END
;; STEAM IMPLEMENTATION START
[OnlineSubsystem]
PollingIntervalInMs=20
;DefaultPlatformService=Null
DefaultPlatformService=Steam
VoiceNotificationDelta=0.2
bHasVoiceEnabled=true
[OnlineSubsystemSteam]
bEnabled=true
SteamDevAppId=XXX
SteamAppId=XXX
GameServerQueryPort=27015
bRelaunchInSteam=false
GameVersion=1.0.0.0
bVACEnabled=1
bAllowP2PPacketRelay=true
P2PConnectionTimeout=90
; This is to prevent subsystem from reading other achievements that may be defined in parent .ini
Achievement_0_Id=""
[/Script/Engine.Engine]
!NetDriverDefinitions=ClearArray
;+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="/Script/OnlineSubsystemUtils.IpNetDriver",DriverClassNameFallback="/Script/OnlineSubsystemUtils.IpNetDriver")
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="OnlineSubsystemSteam.SteamNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")
[/Script/OnlineSubsystemSteam.SteamNetDriver]
NetConnectionClassName="OnlineSubsystemSteam.SteamNetConnection"
;; STEAM IMPLEMENTATION END
That's all I have in the Ini
And I only have a modified JoinSession Node cause we passed the VR device name over
Otherwise it should be the default nodes
And in the PC
void ASomePlayerController::K2_StartTalking()
{
bool bUsesPushToTalk;
GConfig->GetBool(TEXT("/Script/Engine.GameSession"), TEXT("bRequiresPushToTalk"), bUsesPushToTalk, GGameIni);
if (bUsesPushToTalk)
{
StartTalking();
}
}
void ASomePlayerController::K2_StopTalking()
{
bool bUsesPushToTalk;
GConfig->GetBool(TEXT("/Script/Engine.GameSession"), TEXT("bRequiresPushToTalk"), bUsesPushToTalk, GGameIni);
if (bUsesPushToTalk)
{
StopTalking();
}
}
(we have PTT)
Then some more "Mute/Unmute" functions
As well as the PlayerState exposing a "OnTalkStateChanged" event
But that is all just extras
90% sure that's all I did
It worked locally with 2 PCs over Steam.
Never tested it online though
Thank you very much cedric_eXi ! The only notable difference here is the use of "StartTalking" and "StopTalking" where we've been using "StartNetworkVoice" and "StopNetworkVoice" in Blueprint, which are both calling StartTalking and StopTalking in cpp as shown here from the Engine :
@gloomy flint just noticed isn't it Run On Server if you want it to run on server and called from client
We also are not using Steam OnlineSubSystem.
We'll proceed with some testing based on your exhaustive information, trying to implement VOIP through cpp this time, and come back to you to report whatever result we had.
Thanks again !
Hi guys i have a quick question abot the COND_InitialOnly and Deffered spawning. Would calling a deffered spawn delay sending the initial properties
Does anyone know the proper way to destroy a replicated actor in BeginPlay? This is causing them not to get destroyed on clients. I guess deleting them on the server before they replicate to the clients causes them not to get destroyed on the clients. Trying to avoid using a hacky delay.
void AFPSGunPickupZone::BeginPlay() {
Super::BeginPlay();
if (Role == ROLE_Authority) {
// Destroy the gun pickup zones if pickups are disabled
AFPSGameMode* GM = Cast<AFPSGameMode>(GetWorld()->GetAuthGameMode());
if (GM && !GM->GameVariant.SpawnPickups) {
Destroy();
}
}
}
The ideal case would be to not have them spawn at all if at all possible
Right, they are placed in the editor tho in this case
@jolly siren perhaps you could put them in a sublevel and check in the level blue print before loading the sublevel
That way they are never loaded
The level blueprint could check game mode and then load up the sublevel with the pickups etc
That is a good idea jespersbane
@jolly siren Thanks ^_^
Couldn't I also set bNetLoadOnClient to false?
Or will placed map actors not replicate on initial creation?
they would not load up on the clients at all afiak
ah okay, yeah I think you are right. Was hoping they would replicate instead of loading, so in that case they just wouldn't replicate over if destroyed on the server. But I don't think that is the case.
Hey guys, this is my first question here and I am looking for some basic multiplayer advice. Our multiplayer project has the possibility to spawn as different roles, there is a VR role which results in a "VR_Character" being spawned. And there is an observer role which is a pawn type atm. as both are VR-controller, both c++ classes replicate their transform in tick. starting a listen server and being spawned as the VR character role, i can see the observer pawn moving around etc. but unfortunately not the other way round. The observer does not see the character. There are 2 playerstates that the observers sees and I checked that the server and client transforms for the observer is the same. Atm i am more confused about where to look. Is this a character or observer problem? I did not check any more details except there are 2 playerstates that the observer sees. but not if he gets the correct VR-Char transforms or something. Any help would be appreciated
Any clue where the hard cap for replicated objects is located? The cap is set to ~10,000 roughly, but I'd like to know what manages it.
you don goofed if you go anywhere near that limit
Unless you plan on making your own run-time levels for people to modify? 😉
Still a terrible idea
You can't replicate that much, period, it won't work
@swift topaz If you're doing runtime levels you should have the level components un-networked, spawned locally based on a common information
Send a map file over the network once, parse it, spawn everything
One of the main issues with that is the interactive component. Replication is still required if you have objects you need to properly update. Say opening doors, turning lights on and off, opening chests. All these elements still need to exist on all machines. Especially if you try to move things around like a bookcase and you want everyone to see the state it's in.
send a random seed, generate the same map on every machine is always nice
and if number of types of objects is limited, you could have a manager actor/component handle their "replication"
There's no procedural generation either. The map is being created by a player for other players to interact with.
looked at FFastArraySerialization?
it will replicate structs in an array, but only ones that were added/changed/removed, and it can fire client side notifications
have not looked at that, will have to look into it
NetworkSerialization.h has a lot of comments explaining how it works, and an example of how to implement it
guys you don't need to replicate every switch or doorknob, only the action that activates it
sending single multicast boolean is much cheaper than replicating door animation to all clients
replicating a state in above mentioned struct works too, and it doesn't leave late joiners in invalid state
Hello, all. Another day, another multiplayer problem. I have changed my entire Pawn structure to use SkeletalMeshes as their root scene component, and that seems to properly allow my NPCs to replicate their location correctly. However, my player-driven Pawns are not properly replicated to clients. What's weird I can see that they are moving on the server based on where their particle effects are playing on the clients, but the skeletal meshes and actor locations REFUSE to change on the client(s). To reiterate: my NPC Pawns are moving and replicating correctly as far as I can tell. My Player Pawns are not updating their positions on clients and I am struggling to figure out why. I have set Replicates, Replicate Movement, Always Relevant, and Never Dormant, and several other settings for the Player Pawns, but still nothing works
What's extra weird is I've also set up some debug printing of the Player Pawn's location. And it reports that the Pawn is in 2 different places over the course of a few frames: the location that is has been driven to, and a location very close to 0,0,0
i do think CMC prefers a capsule
I am not using a CMC
correct me if I'm wrong, but when a player attempts to place down a door that other players can interact with, that door should be server spawned so that you can do/see the interactions from every player client, does that not require the door to be replicated?
do go on, cause you just blew my mind
You can broadcast a message that says "I placed a door here"
Without having the door itself replicated
now with Actors loaded from a package, that is easier
you know, shit gets really weird when you start optimizing network bandwidth
as they can be referenced over network, non replicated, out of the box
but, it is expensive
you can't send a pointer to a door inside a Multicast event later, and say OpenThisDoor
that is the drawback
assuming there are <250 doors, tag-em
sorry, less than 4 million doors
getting generous and using integer
you can use above mentioned FFastArraySerialization to keep them in sync - trivial example, you have TSubclass<ADoor>, FTransform and bools bOpen and bLocked
inside the FFastArraySerializerItem struct
its callback for Added spawns a door at the right Transform in the right state
and its callbacks for change... well, change the state
downside is that you would probably need a separate custom serialization for each group of Actors
unless it's just an actor
upside is that your struct could store a pointer to actual Actor in its added callback, which would solve referencing non-replicated dynamically added Actors over network for you
yeah, but then you have to account for every state every Actor can have
in single struct
Thanks for the information, looks like we'll have to re-structure the way actors get created and exist in the world.
OK, more info
I changed the settings to 2 clients. The non-owning client gets the updated position for P1
But P1's client does not
How is that even POSSIBLE?
no one an opinion to my question? 😄
what do you use for movement component again @ocean dust
Nothing
ReplicatesMovement might avoid sending updates to owning client
But it sends them to other clients? That seems....weird
its usually assumed that owning client has a fair idea on how to simulate it
CMC won't replicate stuff like Velocity to the Owner to save bandwidth, for example
if that pattern holds...
well, that and it might cause a jitter in the simulation as well
Well, I tried using a Multicast event to sync the transform
and it still didn't work
this is the strangest thing I've seen so far
@covert flame - Unfortunately you're going to have to put more effort into it than that. Your description is very subjective, and you really haven't provided much details, code, blueprints, etc. Replication is a very complex subject, and posting with just a result leaves no one with any real data.
Is it possible for a dedicated server or listen client to load more than one level at a time?
In other words, have players connected to each other but in different levels?
@calm hound Well, hmm I see. I thought that it would be good enough to give hints if I tell you my obersavtions but one character seeing the pawn but not vice-versa but sure, gotta check more data anyway 😃
Only one dedicated server per map is possible @ocean dust all players exist on the same server, ergo same map. You can server travel everyone to other maps (borderlands style), but if you want to jump to a completely separate server, then a diff dedicated server needs to be launched which will take care of the other map.
Well damn. I want to enable players to go into different areas independently of one another. Is that even possible in UE4?
Also, thanks for the info
afaik, not out of the box, you would need to spin up one server per map and then direct players from one server to the other, passing relevant information via connect options.
Is it possible to spin up a dedicated server of the game on a player's computer and also have a client run without making that player a listen server?
In other words, can I run a dedicated server on my computer and play with my friends on that dedicated server on the same computer without having to run command line programs or jump through crazy hoops to get the server set up?
You can run a dedicated server on your machine and have people connect to it the same way as a listen server, yes.
What are the nodes for starting/stopping a dedicated server? Is this possible in BP?
Or in C++?
You just need to build the dedicated server, just means you need to get engine source code and compile so that you can create dedicated server builds. Then all you gotta do is launch the server executable and you're done.