#multiplayer
1 messages ยท Page 610 of 1
Quick Question: This is mainly curiosity but computers that host your game's server, is it all just one big server that is cut up into 12 player lobbies or are they are all individual servers.
This is a very stupid question I know but curiosity is a powerful thing ๐
A single server process is usually just one lobby, doing more than that makes things way more complicated.
For the actual hardware, most servers these days are virtualized - one physical host will be running multiple virtual machines (or sometimes containers, though I'm unsure how common that specific bit of tech is for games). Whether a single VM runs multiple server processes is highly dependent on the game.
Oh so a more complicated game will usually host less server processes on a single VM?
no
It's a cost thing - how much can you divide up a single VM before impacting performance
Oh
it's not as simple as just adjusting the number of processes running either
because you have multiple VM sizes
I'd say it's probably more common to run a single server per VM as it's easier to guarantee resources that way
but it's complicated
Why do they use VMs though? If it is all run on a single hardware device why not just run multiple services on the PC itself.
because no one wants to build out a datacenter (or buy out sections of one/colocate) these days because that's expensive and not scaleable
why buy the physical hardware when you can rent VMs on a cloud
or if you do happen to own the datacenter, why build out hardware for one specific game when you could support any number of your games (because you're big enough to have multiple if you have a datacenter)
and scale them automatically
If you're an "independent" AAA you probably don't have the capital to build out the infrastructure worldwide so cloud is basically the only real option that will scale no matter how many (or few) players you have. If you're a large AAA like EA then you probably use a hybrid approach but most stuff is probably still virtualized. If you're microsoft... you own the cloud, why not use it.
And if you're an indie you're definitely not building out your own infrastructure.
Yea true
This clears up a lot of confusion thank you!
Usually when you're dealing with hosted VMs there are really beefy physical servers behind them, so beefy that it's probably already running instances of other VMs on it - and what happens is you just get to use a slice of the computer power available on whatever physical server your VM runs on. If you went with AWS for example, you pick between different sizes of instances, which have different CPU & RAM availability, and whenever you activate it, it then starts running on whatever hardware is available at the time for your instance size to use.
Even if you request a VM host somewhere for a really powerful VM, with tons of RAM, there's still a good likelyhood that other processes will also be running on the same physical server. It's only if you get dedicated hosting (they have server hardware you're effectively renting + it's dedicated for your use only), or co-hosting (you own the physical server, they're just a place for your server to be plugged in with redundant power, proper cooling & extremely high-speed internet access) that you're guaranteed you're the only thing running on the server hardware.
Yep, this is also important to know about VMs
First of all, wow. The fact you typed all this out is insane. Second of all, thank you this really explains server hosting and VMs really well!
This will be really helpful for looking for cloud server hosting!
Not gonna lie, they should pin this for more people to see.
Im new to multiplayer, why is all the clients swapping weapons fine and seen by everyone but the host only swaps their weapons on their own screen but sees everyone else's fine.
@rain quest can't really read your screenshot my phone, but for swapping weapons, the input should just trigger a run-on server event that swaps the weapons around. The current weapon should be replicated and in the rep notify, that is where you would play your animations etc.
You shouldn't even need a switch has authority, the flow will be the same whether you are hosting or not.
QQ; let says I have a replicated variable.. can I set that on the server to give it an init value (and never touch it again) but then let the client work out it without worrying about the server touching it again?
Why does it need to be replicated if the server won't change it ?
Because only the server has the initial value it should be set to
My concern with using a multicast is that this is set during the spawning of the actor; and as far as I know events can be problematic / missed if issued on an actor that has just spawned (correct me if I'm wrong)
never use multicasts for stateful changes
only for fire and forget stuff
your variable should be replicated with InitialOnly condition
Ah! thanks
but just for the record, if the server never touches it again the client would be free to use?
note that you need to set it on server before it replicates, like immediately after spawning an Actor
or clients would have the wrong value
Rite, so anything initialOnly needs to be set immediately ๐
it is bad practice for clients to operate on replicated variables
so best have 2 of them, 1 replicated, one not, but set from OnRep_FirstVariable
Thanks for the clarification, I'll do that
Does anyone know if itโs possible to replicate a render target, or the data in it and rewrite to a render target?
Or would I be better off using scene capture?
You can read the data back and replicate it, but it's extremely expensive
I thought that might be the case
best bet is to let client also generate it
Yeah definitely
what is that?
it's just a whiteboard kind of set up
using UV's
I'm wondering if I send where to write to everytime someone writes might be the way to go
Sending deltas is probably a better way indeed
cheers for the help guys! I will try that instead
For players that join late you'll still need to send the initial state ofc
so send the whole rendertarget data on joining basically?
I'll start with the replication first but I'll try get that working also
Hello, i have the following problem: When creating a widget from my Character BP (After being possessed by a player controller) the widget gets added to every clients viewport and not just the one that owns the character
how do i possess a vehicle in multiplayer ?
@whole urchin call possess on it.
Controller->Possess(TheVehiclePawn);
Assuming you are using the engines' vehicles, and not your own approach
You only call Possess Server-Side, btw
i did that, it doesnt work
Probably something project specific then
in blueprint please
Same deal
Is the vehicle a pawn?
yes
Are you calling possess from the server or client side?
server side
Screenshot your blueprint so we can take a look at it
does it make a difference if i do it in controller blueprint or in some other BP ?
Your options are the controller or your currently possessed Pawn pretty much
The only thing that matters is whether you are calling it on the Server
If you are, and it doesn't work, then it's going to be something project specific
Looks fine
Check the values of the variables
i will
Vehicle being replicated is a strange choice for example, usually you'd pass the vehicle pointer with the Server RPC
Since presumably the Client is the one who decides what they want to possess
it returns nothing, why
you mean Vehicle is null?
it was a foolish attempt, ignore it please
yes
There ya go then ๐
but why
Well obviously you haven't set it
i have set it
If it's null, you haven't set it (on the Server)
Again though, why the Vehicle variable is replicated and not being passed via the RPC I don't understand. The setup is odd.
@whole urchin show where you are setting that vehicle reference
Does the spaceship exist on the map already?
ya
Try get all actors of class and print the length of that array. Should be one right?
I've never seen that node get actor of class
i got the vehicle reference in server RPC, and it possessed
succeess
but i can't move it
any suggestions ?
By default vehicles have no network functionality, it's worth pointing that out
I think the engines' Wheeled Vehicle Movement has some very basic code, but otherwise nothing else does (e.g, floating pawns etc.)
but isn't FloatingMovementComponent (or any move component ) already replicated ?
no, a shape of that will come soon with Dave Ratti's net prediction plugin
Hi everyone! Quick question. I want to add a component to my character that is only relevant on the server and I'd like for it to not exist on the client. HasAuthority somehow wrecks everything because the non-existant component's BeginPlay gets called anyway. Is this approach wrong all together or am I doing something wrong?
Relevancy is done at the actor level, components can't have different relevancy from their owning actor
yeah you should use owner's relevancy
I mean you could add a (non-replicated) component at runtime on the Authority only, but that's probably not the most resilient design
Okay so if I want the component on the actor, I add it anyway and just block it from being used on the client, is that right
?
If you want it as a default component then yeah, you don't have a choice really
maybe you can dance a bit using with_editor pragmas xD
I wouldn't want to mess with that ๐ Too many unexpected crashes
hello, how i can serialize float?
When adding my Widget through the Character it gets added to every players viewport - when there are 2 players there are also 2 widgets on top of each other
Any help?
@glossy veldt check for IsLocallyControlled before adding the widget to the screen
@thomson so before add to viewport?
After BeginPlay before GameplayPCRef
Alright will try
now the client only has his hud but the listen server has no Hud
When i do it like this
@empty axle Any idea why?
Nevermind - fixed it by adding a small delay after begin play because for some reason the listen server takes a bit of time to register that he is controlling a pawn
never use delays for these cases!!!!
Can I add a replicated Actor to a Level?
How does the ownership/replication work?
actually I already KNOW that I can ๐
I guess what I'm wondering is, if an Actor is loaded as part of the world on a Client, is it possible to know when it has been initially replicated?
AActor::OnActorChannelOpen on client and OnSerializeNewActor on server
Thank you Sir!
the Pre/PostNetReceive seems a less intrusive way to go about it
@chrome bay in your blog post (https://jambax.co.uk/replicating-uobjects/) you mentioned that subobjects are always created client-side using the Actor as the Outer.
So replication that way is client -> server?
I mean the client would create the object just fine but it would get replaced by the server object.
The one the client allocated would eventually be garbage collected right?
Replication always goes from Server to Client, despite ServerRPCs.
@lament sinew when client instantiates a subobject from replication (AActor::OnSubobjectCreatedFromReplication() callback)
those subobjects always have that Actor as the Outer
no matter what the Outer actually is on server
So I've been following tutorials on building a multiplayer server, I wanted to dive deeper into how things work does anyone have any good learning resources?
I'm making a fps game and the whole "weapon fire" process runs on server, how can I update players hud ammo in clip information? Should I get my weapon ammo amount at each draw?
@steel fox is your gameplay Logic coupled with GAS?
@winged badger yeah it should be constructed with the GUID from the replicated data, but i thought i needed to create it again on client-side lol
the point was
if no then you need to have one variable like UPROPERTY(ReplicatedUsing = onRep_AmmoCountCallback) AmmoCount;
if your say, ActorComponent on server instantiated a replicated UObject with itself as Outer
GAS? Never heard of it, I don't think
when that UObject replicated, its Outer would be the Actor that replicated if over its channel
Ok thank you
not the ActorComponent
and whenever AmmoCount is updated by server, client will get callback in that function
GAS -> GameplayAbilitySystem #gameplay-ability-system @steel fox
I have an ADS camera attached to my gun. I use set view target with blend when pressing / releasing the aim key.
The blend works nicely if you let it complete fully. The problem is that, if you stop aiming during the transition to the ADS camera, which sets the view target back to the original camera, it snaps instead of blending
I guess you can't blend to the current view target. Is there any solution to this problem that doesn't involve manually moving my camera for ADS?
bLockOutgoing won't work, because the camera will get offset by player movement
Hello everyone, I still have an issue with my aim offset replication, so here's a few questions to help me fix this one time for all :
-What value should I use to replicate the pitch accross the network? Control Rotation?
-What variable should keep this value? Default camera?
-After that, I just use my Default camera rotation for the AimOffset right?
Here's a picture of my BP_character. And last question : to trace a line, I just have to use my default camera location for the starting point, and my default camera getForwardVector multiplied by a value for the end point right?
Does anyone know how to replicate a variable in animinstance to all players? I know it's a UObject, but I have that integer variable that changes the animation pose and I was trying to set it when I need to instead of getting it at each anim update, using UPROPERTY(Replicated) and setting it on Server or Multicast changes the value only on the server and not on the other clients(on listen server the new pose is visible while on clients it isn't)
@steel fox why does the state need to be replicated inside the anim instance?
@wise bridge control rotation is owned by the controller.
I can just get it from the player pawn, but I was curious to know if it's possible to replicate it, I need it to know wich animation pose to play(AnimationBlendspace)
So, what should I use ? Default camera for replication?
@steel fox animinstance is local only. No replication at all. not even RPC's.
That's because it's a child of UObject right? UObjects really have no way to have replicated things?
no
its cause its local only
UObjects can replicate just fine
if setup properly
but animinstance should and is local only
@twin juniper That's not a bug, that's just latency. If something is spawned on server, it has to replicate back to the client which takes time. Once it replicates, it has already traveled X distance on server. You need to spawn a local projectile on the client that doesn't have damage authority, and does what the server's projectile does.
Anybody know how to make certain components of actors only visible to certain players?
hey guys, I really need some help.. I've been at this the entire day - no joke..
I can't figure it out. I have a custom replication graph and when it is active, I can't do multicasts anymore.
The problem is also there in ShooterGame.. I created a custom player controller and added this: https://i.imgur.com/iJfCpFJ.png
As soon as that multicast hits, the player controller dies.
This is my output:
LogBlueprintUserMessages: [BP_PlayerController_C_0] Server: MULTI! ---------------------------------------------------------------------
LogBlueprintUserMessages: [BP_PlayerController_C_0] Client 1: MULTI! ---------------------------------------------------------------------
LogBlueprintUserMessages: [BP_PlayerController_C_1] Client 2: MULTI! ---------------------------------------------------------------------
LogNet: Received invalid swap message with child index -1
LogNet: Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor BP_PlayerController_C_0. Function Servertest will not be processed.
LogBlueprintUserMessages: [BP_PlayerController_C_1] Client 2: PC got destroyed
LogNet: Received invalid swap message with child index -1 this line appears, soon as I do the multicast and later, the PC has no owning connection anymore.
It seems to me for some reason there is a swap in player controllers and that fails because INDEX_NONE is sent. ( https://github.com/EpicGames/UnrealEngine/blob/release/Engine/Source/Runtime/Engine/Private/NetConnection.cpp#L3708 )
I've tried to have PlayerController replicated in every which way I could come up with but it doesn't change anything.
I really need this to continue with my project. Help would be highly appreciated
Seems related: https://answers.unrealengine.com/questions/706243/view.html
oh man, damn
@lethal oracle thanks so much
it's weird though, I don't have these problems when the replication graph is not active
you wouldn't use multicast on a player controller though
^
that or player state are likely the appropriate places for whatever you're doing. only the owning client knows of their player controller, you don't know about anyone else's
right, yea, that makes sense.. somewhat
Hello Friends,
I have some question about MP in UE4. Games like Fortnite have dedicated server hosted on the Epic Games. They handle with multiple matches at the same time. When X player check ready to play, the master server group they and setup a new sub server and/or session to this players. Each match have X clients at start playing the same game with the same level with the game mode and game state of the specific match.The questions:
1 - Each match have a dedicated server process (.exe) running to control the game or the same dedicated server process can handle multiples sessions of the same level at different times?
2 - What is the best way to develop this solution to control and handle multiples matches of the same level?
3 - Any tutorial or documentation of how to do this?
I'm glad if someone can help me to understand the logic flow and give a tip of how to replicate this
^^
- A single process usually only handles one game, there are lots of additional complications that likely aren't worth it if you want to handle multiple games.
- It's completely up to you to develop something like that, or you can use a service like gamelift or playfab.
- You're on your own for that unless you're using a service as mentioned above.
ty for your answers๐
so...I'm trying to create a solution of master and sub server
when the master server / lobby got X players ready to play, him create another process of dedicated server running the level and travel all players...it's right?
You definitely do not want a "master" server to be a real dedicated server instance. There's no way that can scale up for the number of players.
Any lobby or matchmaking system will involve a number of web services that the game calls out to in order to find out where to connect
this is an area unto itself, no one here is going to be able to tell you how to make all that because it's a massive undertaking
I suggest looking at the services I mentioned first. If you still really want to build something yourself then at least read up on how those services work.
Does OnRep call on other players clients
I'm not sure what you mean, an OnRep or what?
a Blueprint OnRep will call on the server and each client the actor is relevant to
in C++, you have to manually call an OnRep function after changing a variable on the server (if desired)
probably should be using the reply feature more
Oh sorry I mean a ReplicatedUsing function
If an OnRep/ReplicatedUsing function is triggered, who is it triggered on? The owning client only?
the replication system calls it on every client where the actor exists
ie "is relevant to"
if the actor is dormant, you won't get it until the actor is awake or you force a net update but that's getting more advance than what you're looking at
you'd only get it on the owning client if the replication condition was COND_OwnerOnly
oh
how do u guys typically handle race conditions between replicated objects and the pointers to those objects inside the things that own them? for example i have a component with an array of uobjects, it replicates all of those objects. However in the callback from changing that array (adding a new object on the server), the object will sometimes not be replicated when the array says it has a new item, or vice versa, the object might check something and see it is not yet in the component's array of objects.
is there a BeginPlay equivalent in UObject that I could use to just tell the owning component that the object is ready to go when it's actually done replicating
fastarrays will fire changed when the object is resolved if its null during add
and typically its not a race condition - same array always fails or always succeeds
so in postreplicatedadd I can check if the pointer is null, and if so do nothing, then in postreplicatedchange check if its valid and then actually add it to the owner's array if it hasn't been?
er, it'd already be in the array, but i'd know i can use it
i feel like every time i have a multiplayer question in here its just you popping in and telling me how fastarrays are here to solve all the problems lol
you can also swap the position of Super in ReplicateSubobjects
make the array replicate after the subobjects
Hello I am having an issue in my VR project I'd like to ask for advice, here's my forum post of the issue https://forums.unrealengine.com/development-discussion/blueprint-visual-scripting/1854196-issue-with-possession-and-setting-vr-hand-owner
Hello, so I am making a multiplayer Titanfall inspired VR game where you can control the pilot as well as the mech. Now both the pilot pawn and the mech pawn have VR hands that I need to take control of in order to work properly, but I am currently running into an issue.
My issue is that I need to take ownership of the VR
the gist of it is that I am trying to take ownership of som VR hands but on the client side, I've only found success by running the setup on tick which is bad
I'd love to hear any ideas about what is going on
I am making a multiplayer test class and I need All my clients to be able to send information back to server. However I dont want to modify the Pawn. Any ideas for this?
I'm currently thinking spawn an Actor for each client, owned by the client that can RPC to the server, but is there any nicer ways?
if its a test class
can be just an ActorComponent
RPCs work just fine, as long as they are on owned Actor @silent valley
yes this is the problem ๐
there is 1 test class owned by server, but how do each of the clients report back to the server?
I have decided to create a client owned Actor for each client, and use that
replicated ActorComponents on owned Actors can RPC
standalone Actor works too, as long as its spawned and had SetOwner called on it server-side
Hi all for multiplayer, in which class i should implement spawn item logic. I have created logic in game mode and used multicast event for spawn. But i can not see items on each client. I believed spawning should be done only by server so i used game mode BP
No one? I'm still stuck on this :(
That's fine - depending how your items are setup, you will also need to spawn the Items on the server. You can do that in GameMode too after spawning the player pawn.
@silent valley Thank you, I have item actor class with mesh. Then in game mode i am looping for all target points and spawn actor at target location. So why items are not visible on clients?
Just to test i created this in game mode. but i get output "Server: Hello" .
Is this normal?
possibly in BeginPlay the clients are not yet connected
how would i check if clients are connected in game mode?
oh and also GameMode only exists on Server not clients
so NetMulticast will not send anything to any clients anyway
i see, so this means, i cant spawn items to all clients in game mode?
hmm I think you're missing something fundamental here
i am sure, need to learn
generally, only Server should create Actors, and any replicated actors created on Server will also be created on all clients
so if you use SpawnActor in GameMode (server) to spawn a Replicated item actor, then it should also be created on clients too
i see so i need to tick "Replicated" checkbox inside actor itself
yes, inside your item actor I guess
Done, but same result. @silent valley
is the item definitely visible on server? and it's just not appearing on client? you using Listen mode?
yes 100%
idk, it should be working based on what you've told me ๐คท
I'd put some more logging in and try and narrow it down that way
but I've not really used BP
I am going to test it on a fresh game, let me see if i can grasp some understanding. I hope you dont mind if i ping you with DM.
just ask in this channel please
ok, thanks
Would the GameState be the best place for AIs to generate random patrol points so every AI on clients will sync their patrol or is there a better place for that?
So doing it in the AIC would work then?
well AI is server only, so you don't need to replicate anything to do with its path
just generate it on the AI or make an AI director if you need predefined random paths or w/e
AIC is server only but not the pawn correct?
rn each AI creates its own random location on each client version.
so putting random locale on the pawn is not working rn.
This is on the pawn:
//We get a random direction, then set a location based on that and finally we clamp it to the navigation zone
FVector AAI_Bot_Pawn::GetRandomLocationInNavigableZone()
{
return ClampLocationToNavigableZone((UKismetMathLibrary::RandomUnitVector() * MovingRange + GetActorLocation()));
}
why would the pawn handle that?
and each client does its own version of it
ai controller should handle all movement
problem is I cannot get the AIC from the controlled pawn in multiplayer, so how do I tell it that it needs to generate a new patrol point?
why cant you
I think thats the framework.
I tried to do it and it wouldn't let me obtain the AIC from the controlled pawn in multiplayer.
pawn on client and AIC only on server.
the server pawn could get it I believe, but the client pawns could not.
wouldn't*
not would
my pawn navigates and then collides and then generates random location to go to.
I tried to get the AIC from the AI pawn to tell it to generate a new patrol point, but I cannot get the AIC from the pawn.
AI should be spawned server only
dont forget, pawn overlaps will fire on client and server
This would only be the case if I was spawning through game mode correct?
ok
So you saying...
When collision, use hasauthority check to get new control point. right?
in the AIC
I'm spawning AI in a spawn manager that is in the level already and not spawned.
So I think it exists on the client and server when AI is spawned.
This will always fail unless I wrap it in a HasAuthority check correct?:
AAI_Bot_Controller* AIBotController = Cast<AAI_Bot_Controller>(GetController());
yes
your ai should only spawn on server
and be replicated
so your spawn manager needs to make sure its only running spawns on the server
so I should put that in a HasAuthority check in the spawn manager then.
yes, and overlaps on pawn run on both client and server, so those will need to be gated
the pawns will replicate automatically?
ok, thanks I'll get on it. I appreciate it. BTW, I'm not using the movement comp Im using the Network Prediction plugin.
for movement.
does this work?
Woah, just started upgrading my project to 4.26. They really rewrote the CMC's RPC system! Not sure if this was mentioned here already? Probably ๐คฃ .
"// Use newer RPCs and RPC parameter serialization that allow variable length data without changing engine APIs."
To see the changes, you can run the UCharacterMovementComponent from 4.25 against the 4.26 variant in a diff checker. Same thing goes for the accompanying stuff in ACharacter.
I had to rewrite some parts of the engine API (but managed to get it done in child classes) to make up for the severely-limited compressed flags before, due to a large amount of custom move data. Looks like I'm going to have to do another big refactor to use the new API while I wait for Network Prediction to mature. Just wondering if that's really the best use of my time right now, without knowing when Network Prediction will hit production-ready (I'm still playing around with it, but not in my production project).
They have already started on a Net-Prediction driven character movement setup IIRC
There's early parts of that in the Master branch already
Hello everyone, I still have an issue with my aim offset replication, so here's a few questions to help me fix this one time for all :
-What value should I use to replicate the pitch accross the network? Control Rotation?
-What variable should keep this value? Default camera?
-After that, I just use my Default camera rotation for the AimOffset right?
Here's a picture of my BP_character. And last question : to trace a line, I just have to use my default camera location for the starting point, and my default camera getForwardVector multiplied by a value for the end point right?
That's exciting!
yes it does. wait....which part?
with GAS? as per my understanding it isn't compatible with GAS at the moment. @ember osprey
I'm using gas and Network prediction plugin for movement.
@polar wing don't expect network prediction to be stable for at least a year
I don't think they've checked anything into that plugin for ~3 months now
Probs busy with UE5
I have to port all my AI navigation code over to the Network Prediction code.
I only had my player movement setup through NPP.
wdym?
Shouldn't have to, the point of network prediction is to write the simulation code only
And not have to think about the networking side (as much), let alone AI side
I used GAS to set movement parameters on my player's movement that is setup using NPP.
Gotcha! I will do my little rewrite to the CMC, then.
is this for me?
Nah, 8ball
the same way you would with CMC but with NPP
???
I'd be careful writing any code based on the NPP right now, it's going to change a lot still
oh IK
lol
this i can do. But the AbilityTasks are already tightly coupled with MovementComponent not NPP
Dave said the core is pretty much set though
in 4.26
does this mean the abstract APIs are frozen for NPP?
I would have to refactor everything to work with 426 NPP
i assume that is what he means
Not going to bet the stability of my project on that though ๐
Not until they go full official anyway
though, virtual FVector ComputeVelocity(float DeltaSeconds, const FVector& InitialVelocity, const TNetSimInput<CharacterMotionStateTypes>& Input, const TNetSimOutput<CharacterMotionStateTypes>& Output, const FVector& LocalSpaceMovementInput) const;
specifically const TNetSimInput<CharacterMotionStateTypes>& Input, const TNetSimOutput<CharacterMotionStateTypes>& Output
I'm doing a Flying game.
CMC doesn't work well with flying.
๐คข
for both of them
yeah lot of that in there.
as they are the same, and require the same type
just one is input and one is output
so it could have been one variable/param
```using CharacterMotionStateTypes = TNetworkPredictionStateTypes<FCharacterMotionInputCmd, FCharacterMotionSyncState, FCharacterMotionAuxState>;````
hmm
Well I get to implement the AI navigation manually using NPP this time. I love doing movement network replication. lol. jk it shouldn't be too hard 
@meager spade btw, I had to wrap everything in the Role Authority if, that makes the pawns sync ,but now the since everything is on the server movement is not replicated and I have to implement it myself because i'm using the CMC. Thanks for the help.
I m going to explore NPP, so anyone can point to the branch which contains latest NPP commits.
thanks, I already have master built on my machine.
๐
Hey Friends,
i'm trying to test the shortcut to run dedicated server from .ink with -server -log parameters but dont work...the console lock on this image below...
So, it seems like an initial only replicated variable will act as intended and withold from spamming replications if you call a force net update... unless you set your actor dormant. because of course a dormant actor is what you want spamming your big initial only replicated struct.... UE, why....
trying to use: "C:\Program Files\Epic Games\UE_4.26\Engine\Binaries\Win64\UE4Editor.exe" "C:\Users\Leandro\Documents\Unreal Projects\MyProject\MyProject.uproject" -server -log
@distant talon Dormancy closes the actor channel, so when you wake it up again it's treated as a new actor
hi guys,
i have 2 maps (Lobby and InGame)
That's so confusing, but thank you for the explanation
i set dedicated server with default server map InGame
Any tip why my server is locked?
then i try to open level
but the log says
"LogNet: Browse: 127.0.0.1/Game/Maps/Lobby"
when i open level from client
bind 0.0.0.0 on 7777 port???
i dont know why it browse the wrong map
yes
how to fix?
@distant talon Dormancy is tricky to use properly
as Actor becoming relevant for some client won't wake it up from dormancy
meaning that client will have the wrong state
Hey Friends,
Trying to test my project as dedicated server using the shortcut method like "C:\Program Files\Epic Games\UE_4.26\Engine\Binaries\Win64\UE4Editor.exe" "C:\Users\Leandro\Documents\Unreal Projects\MyProject\MyProject.uproject" -server -log
the console open but freeze on [2021.01.19-14.42.24:803][ 0]LogInit: First time updating LLM stats...players cannot connect...like image above...
This does not work anymore? How to fix? Have a new way to do this?
i'm using 4.26.0 UE version from launcher
So I just need to spawn a client-side dummy to mimic the real projectile on the server?
Client-side prediction is a network programming technique used in video games intended to conceal negative effects of high latency connections. The technique attempts to make the player's input feel more instantaneous while governing the player's actions on a remote server.
The process of client-side prediction refers to having the client locall...
hello guy i cannot get the defualt online subsystem to connect over the internet im using this code to find the first server for now and join, if there no server then it will just create a new one . it works in edditor but when over the internet it just cant find any sessions
oh is there any way to do it without using steam i want to keep away from steam for this project
don't create widgets for client controllers on listen server
where do I create the widget?
oh
can I do if(!Authority) to stop that?
or whatever it is
no
you should create widgets only for controller that IsLocalPlayerController()
and you should be creating them from a AHUD derived class
which would eliminate the problem, since HUD is always local only
So is the ideal flow Controller -> HUD -> makes widget?
Controller doesn't have anything to do with making widgets
except being pushed around as Owner
in my game
its not hard to access the HUD directly and request a widget on screen, from anywhere
Hi,
I stumbled upon this in the documentation: "FNames are not generally compressed, so when you are using them as parameters to RPCs, keep in mind that they will generally send the string each call. This can be a lot of overhead."
What should I use instead FString, FText?
FName / FString are fine over network
So really it depends what you're sending / using the RPC for
Definitely don't use FText
I have a huge replicated array of available recipes that the players on the server can use, in the game state. It consists of the RowName and a bool to check if that recipe is unlocked.
You could use GameplayTags and enable to use indices to replicate them. this requires that data on all peers is the same
If it's a huge array, don't use a data table
or FGuid, 128bit
Use a data asset and a big array, access elements by indices instead
Commonly-used FNames such as NAME_None will serialize as an integer, but these names are hardcoded. All other names will serialize as strings.
I'll look into them, never used them.
A data table is just a glorified TMap<FName, SomeData>
can't you add such hardcoded names?
Yeah you can modify UnrealNames.inl and add more
Less useful for a data table though IMO
yeah
GameplayTags FTW though, where it makes sense anyway
Hello everyone, I still have an issue with my aim offset replication, so here's a few questions to help me fix this one time for all :
-What value should I use to replicate the pitch accross the network? Control Rotation?
-What variable should keep this value? Default camera?
-After that, I just use my Default camera rotation for the AimOffset right?
Here's a picture of my BP_character. And last question : to trace a line, I just have to use my default camera location for the starting point, and my default camera getForwardVector multiplied by a value for the end point right?
i hav emovced to using the steam subsystem and am still having the same issues as befor eothers cannot connect
from my debuging the find sessions is sucseeding
but anything after the for loop dosent get called
at this point im really consused to whats wrong
That looks like it's gonna join a session AND create one...
im trying to get it so when you click the button if there is no session then it creates one and if there is a session it will join it
You for sure won't want that loop
ok
sort of like that
this still dosent work over the internet with the new solution i don't know why still not having it work i have the INI file set up correctly and testing with 2 different PCs on different networks
Start with 1 button to create and 1 button to find, and see where it's failing
don't start with trying to make 1 button do everything when you haven't tested the individual parts
i have fixed it it was somehting with the shole system
hey we are using UE 4.22.3 , trying to save player EXP in steam leaderboards
using two blueprint nodes "Write Leaderboard Integer" and "Read Leaderboard Integer"
We have a stat on Steam 'PlayerEXP_PlayerEXP" and a leaderboard "PlayerEXP"
After launching the game so that steam kicks in, then create a steam session, "Read leaderboard value" always return 0 and "write leaderboard value" always return true.
however values never save in the leaderboard on steam what so ever
any clue ?!
No one ? I'm stuck on this :(
hey guys, any idea why the local client running a simple move to would see the character "hopping" or skipping around all glitch like
whereas the non local client would see him moving just fine?
i have a feeling it's a replication issue on the player character but not too sure how to sort that
@shadow arch where is the move to being called from?
Is there a decent way to sync ragdoll physics between client and server when the ragdoll is cut into pieces and blown up? Or is there just going to be too much variation there between client and server?
Is it essential for your game?
I would really like it to be, basically tanks explode and mechs explode leaving corpses
and the corpses take space and provide cover
interesting, physics replication is challenging but if you do this thing server authorative and you just smooth out server results in the clients you could get around that
I'm not sure how to smooth out the entire pose of the skeleton I guess, it's a lot of info..
@dark edge the move was being called on the client instigated by the server. But in the end i solved it. It turned out that there was a setting to enable clientside navMesh. With that setting off the server was moving the character but the client couldn't so that resulted in the client/server synch just teleporting the client character constantly
Usually these limbs are separated objects you can replicate @cosmic trail
@vo oh hmm I guess I've been using the physics assets' constraints breaking ability, which splits the limbs but keeps it as part of the skeleton
let me explain you a real example: Headshots and flying limbs.
take a look at robo recall
usually what you do is you reduce the scale of the bone in the skeleton, and you spawn a limb actor
copying rotation and location of the original arm/head/etc
that way you can apply impulses to separated physics bodies
yeah so say you want to rip off a head you shrink the head of the original to 0, create a clone of the original actor and shrink everything except the head
not exactly because it doesn't need to be a skeletal mesh
it can just be a mesh
of just the head, or the arm, or whatever
ah ic, that's the way to replicate it more easily?
yeah but the mesh of the arm/head etc needs to be made . I'm assuming the quick and dirty way of i don't have models for those ;P
the good old GTA san andreas method lol
yes and no
that solves the problem of being able to treat limbs separately
however, physics replication is still challenging
@cosmic trail i think Halo GDC touched that topic
hello zlo!
hey vorixo
๐
@winged badger recent GDC?
fairly recent
@vo thanks for the info, seems like I got a bit of work to do
i think they replicated the initial state of ragdoll
then let the clients handle the rest on their own
that would be your post-explosion state
ah, I need them to be in sync afterwards too, I got them already in sync pre-ragdoll
yeah... that will bring some errors between clients
yeah you can sync them twice
once initially
cool, which Halo btw if you still remember?
In this 2011 GDC session, Bungie's David Aldridge discusses the programming that drove Halo: Reach's online networking.
Register for GDC: http://ubm.io/2gk5KTU
Join the GDC mailing list: http://www.gdconf.com/subscribe
Follow GDC on Twitter: https://twitter.com/Official_GDC
GDC talks cover a range of developmental topics including game des...
think it was that one
@winged badger Thanks!
yeah, looks good. need to keep learning more about networking
Be nice if unreal could supply a deterministic physics setting in the future... ๐
In this 2011 GDC session, Bungie's David Aldridge discusses the programming that drove Halo: Reach's online networking.
Register for GDC: http://ubm.io/2gk5KTU
Join the GDC mailing list: http://www.gdconf.com/subscribe
Follow GDC on Twitter: https://twitter.com/Official_GDC
GDC talks cover a range of developmental topics including game des...
timestamped it @cosmic trail
watch the whole thing ๐
haha thanks @pallid mesa
I was looking for it as well haahaha
In this 2011 GDC session, Bungie's David Aldridge discusses the programming that drove Halo: Reach's online networking.
๐
Still no one?
Is there a way to force an RPC to go through to the server from the client when the server is the one that is authoratative on the client actor?
@wise bridge u need to keep the variable in whatever actor is shooting, not default camera, and replicate that actor
But it doesn't work for the pitch, or I didn't understand what you said
What should take the value of the control rotation?
@wise bridge are you replicating to the server or to the client?
Client
Not replicated > Server > Multicast
And I want the pitch of my actors to replicate correctly
so there's a pitch variable on the server, and you want to replicate that to the client?
pitch is on one client? and u want it replicated to other clients
Yes
And also, there's no specific variable created by myself, just control rotation and the rotation of my default camera
ok do it this way: Update the pitch to the server via the player controller, then on the server, update each actor's pitch via that player controller's update, set the actor's pitch variable to replicate to other clients. Set it to NoOwner replication
you can update the pitch using an RPC from the client to the server, Unreliable Server RPC
then after you update the actual Server's actors, who all have a pitch variable, u replicate that down using NoOwner
so that the original client does not re-update itself, but it's client authoratitive
Ok thanks, I'm not on my PC right now, I gonna check this tomorrow, I might ping you again if I got any issue. Thanks a lot again dude :D
The Cheat manager exists on the client and I want to call an RPC to the server but at the same time, I want to exclude the function from the shipping build.
I tried using the preprocessor !UE_Build_Shipping but I can't wrap RPC's with it. This Error happens when I try it.
Error: UFUNCTION must not be inside preprocessor blocks, except for WITH_EDITORONLY_DATA
What can I do to exclude cheat functions properly?
Anyone know if it is possible to do a server travel in unreal in a way that the player do not notice?
Scenario: Say the player is on one server just doing their thing and then the server decides the player needs to be transported to another server (same map, same position just a different instance with other players) and the new server accepts that without the player in question noticing (as long as there are no npcs or players around ofc), doable? If you have any advice then please do @acoustic marten
There is no way to push the ccu to more then 100players in one spot even with 10-15k poly Models simple skeletons and changing anything will most likely end up with breaking the replication system right?
The polycount is irrelevant here, problem with 100 users is more the CPU performance, bandwidth, game design, etc
The Main Problem ist that replication is often used in bp and there is not much when it comes to controll so i have to do it in cpp
unless I would do everything in cpp only then would I do more work than necessary
You can do replication either in BP or C++, same thing really
yes but without control if I were to run a console application that sends back and forth to the client with tcp and udp
Replication is meant to interact with other UE4 instances
If you're not doing that, don't use replication
That's what I mean, there is nothing left but to bypass the entire system
There is nothing to bypass really, if you don't want to use UE4 for your server, just run UE4 as single player and ignore all UE4 multiplayer
And then build your own multiplayer system
I just wonder if it's worth it, do you have any experience with it
Depends what you're trying to do, but for the most part, it's probably a terrible idea
There aren't many scenarios where the UE4 replication model is the weak link of your project
Not to mention a non-UE4 server is incredibly tough since you need to duplicate the entire gameplay code in different frameworks or languages
Does the steam multiplayer test ID actually work?
Like can you test multiplayer between two devices with it?
Hmm
Wonder why I can't see the other computer's session
Surely there is more setup required?
Otherwise everyone is using the same id... right?
No more setup required, and no
I guess the UE OSS filters by game name
The only setup needed is enabling the Steam network layer and setting your appid in defaultengine
And having two Steam accounts running their own UE instance of course
Right right
Did all of that
Must be missing something else
Thanks for the help
Do I need to add more than this?
`
[OnlineSubsystem]
DefaultPlatformService=Steam
[OnlineSubsystemSteam]
bEnabled=true
SteamDevAppId=480
Achievement_0_Id=""
[/Script/OnlineSubsystemSteam.SteamNetDriver]
NetConnectionClassName="OnlineSubsystemSteam.SteamNetConnection"
[/Script/Engine.GameEngine]
!NetDriverDefinitions=ClearArray
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="OnlineSubsystemSteam.SteamNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")
`
No, that looks like the usual stuff
Nope
Do I need to have "OnlineSubsystem", "OnlineSubsystemSteam" as public dependancies?
Right now I'm just dynamically loading OnlineSubsystemSteam
I'm currently thinking about safest way to handle player progression in our multiplayer game. We are using playfab and aws services. What I initially thought about using is just the unreal playfab plugin, but in that case the playfab developer secret key is embedded somewhere in the project even though the pak files get encrypted?
What I then thought is to include a text file with a custom secret key only on server build and then use that key to authenticate http calls to aws lambda functions to alter player data. Would this be a fine solution?
Clearly you never want a secret key on clients
Only dedicated servers you control should have it
Yeah but in playfab plugin the secret key is setted in the project settings
Just don't use the plugin on the client then
Hmm maybe I can just leave it out from the settings and read it to the requests from a file on server.
Pretty much anything you put on a client machine, someone will find a way to access. Safest way is to ensure they never get it
Assume anything ever stored, downloaded, streamed, seen by a client, is now public forever
client authorative models are easy at the begining, not that easy when you need to implement an a.c. ๐
Yeah this is what i thought
I put them in the CheatManager class. But I call an Server RPC on the PlayerController that I want to exclude from shipping
CheatManager can call RPC's also btw
have RPC's sorry
so why not move that RPC to cheat manager?
the cheat manager is replicated?
does not need to be replicated for RPC's
so just needs a network name stable path? I see
but it needs to be owned by Client to call server RPC right?
since the PlayerController is "owned" by the client this is given I'd say
yeah, I was talking about the CheatManager
yeah you have to implement a function, ProccessRemoteFunction
err CallRemoteFunction
in the cheat manager
{
if (GetOuterAPlayerController())
{
UNetDriver* NetDriver = GetOuterAPlayerController()->GetNetDriver();
if (NetDriver)
{
NetDriver->ProcessRemoteFunction(GetOuterAPlayerController(), Function, Parameters, OutParams, Stack, this);
return true;
}
}
return false;
}
int32 UKaosCheatManager::GetFunctionCallspace(UFunction* Function, FFrame* Stack)
{
return GetOuterAPlayerController() ? GetOuterAPlayerController()->GetFunctionCallspace(Function, Stack) : FunctionCallspace::Local;
}```
this can also be applied to any UObject to allow RPC's, as long as you can get an actor that ends up with the owner as PlayerController
Hi, I have a question related to client correction. When it is replaying saved movements (from UCharacterMovementComponent::ClientUpdatePositionAfterServerUpdate), apparently it is not using the stored movement mode, so UCharacterMovementComponent::PerformMovement will replay saved movement using current movement mode (that can not be the same as the one when saved move was done initially). Is that correct?
apparently not, or at least I didn't see it. I've seen that the client is replying saved movements with the wrong movement mode, so I guess it is not being passed
hello, what would be the best way to reload a level in multiplayer to get the level back to how it was originally, but still keeping all the same players connected
ServerTravel + seamless travel
would that reload everything i tried to just spawn all the players in reposses them again but some of them they wont become posessed
It would fully reload the entire level and restart
ok thanks for your help mate new to multiplayer trying to learn it
i trying to do a replication of collision response on only players
how i replicate this to players that connect on game later?
how i can replicate this modify state to another player that connect in the future?
using variables?
By replicating the state through UPROPERTY
if i change a variable on the server...when future player connect this will sync automatic to all future players?
need to use repnotify?
would it be possible to pin this? @thin stratus
if not need to use repnotify, i need to make the changes on construct or where?
beginplay?
when i can check if IsPlayerController and not a AI?
not 100% controller has a function for it, Pawn does
but it comes to return PlayerState && !PlayerState->bIsBot;
Pawn function is called IsPlayerControlled
ok ty
for PC it should be obvious its not AI
trying to check if get player state is valid
on my project thay have because attributes are on PS
need to check if is a bot
not work...IA reach the set collision response node and player not
But I assume it allows for some kind of connection to other services as well, databases and login servers and such?
that should go into override of OnRep_PlayerState
ok
that is not possible in BP
@acoustic marten Replication won't work with anything but an UE4 instance , no
You would typically use an HTTP connection for that
Or a plain TCP socket
Replication is a real-time multiplayer system meant for gameplay
Replication is a very simple mechanism tbh
It just copies the server state to clients
There are settings and options but that's basically it
Ah yeah, i wasn't intending to use replication for non gameplay stuff, thanks
i have added server travel it works however the client who is the server will stay in spectator mode and wont be assigned a character im using event handle stating new player but it seems to skip whoever is playing as the server but all other connected clients will be spawned
is there some sort of event whcih fires on the server
@jaunty plank Does President of UK do game development?
sadly not would be some intresting games lol @rich ridge
Traveling simply restarts the entire game, so the logic should work out the same as when the host player originally launched
yea that what i read doing research into it however the server always stays in spectator mode dont know why it the server
How do I make it so every client has a version of an actor, so when they overlap a UI pops up for them and only them
Atm it keeps popping up for all clients
And I donโt really care for the server handling the overlap either since cheating isnโt likely to happen in this case
When the overlap fires, check if it overlapped with player, then check if the player is locallyControlled, then pop ui?
Ahh I knew I was missing an if, cheers
Am I* missing something or is it normal that GetOwner()->GetActorTransform() not working on OnRep functions (when playing as client)? In tick, or in non-replicated functions giving correct values but whenever I use it on an OnRep function its returning my old state and server teleports me back to that old state instead of updating my location
its possible the transform has not updated yet
Its getting updated on local, but server doesnt see it
NetUpdateFrequency is set to 0.9 to demonstrate the movement update
This is my logs, printing location on each function I am using GetOwner()->GetLoc -- Tick Location is not called with OnRep but others are Server RPC or OnRep functions, they dont read the correct value
hello guys i've been looking for a course for multiplayer production over unreal engine 4 for a long time, does anyone know a good course for it
I prefer to be from youtube
dose anyone have any idea why the server travel feature dosent take the person playing as the listen server out of spectator mode?
anybody tried using GGPO netcode with Unreal before?
hey guys, I was wondering if is possible to extend the OnlineSubsystemSteam without having to modify the original classes. Like a plugin or similar
really I need to extend the session interface only
not that i know off
oh ok
I've added some Steam functionalities outside of the OSS, but I'm not sure it's a good idea
iirc its not exposed, so you can't derive from it, also i think you would have to change a lot of stuff
if you are on about FOnlineSessionSteam ?
yeah it seems like that is not possible i could be wrong, but from my quick 2min look, it does not look promising
I think you're right, all the classes are private
So I think I've no options but leave my addictional functions outside the OSS
and to write another OSS seems like a nightmare
could probably copy the plugin source and modify it if you want to go that route
it could work, maybe I'll give a try when I've some spare time
thanks for the suggestion
Ended up being able to multiplayer sync my ragdolls, but pretty costly network updates:
about 60 FVectors per sync tick( every .5 seconds)
think that's ok?
Wouldnt you want to just sync its overall location and let the sim handle all the floppy bits?
Way cheaper, would probably end up looking the same.
similar but doesn't end up the same. I add an impulse on death too, the higher the impulse, the more divergent
I need it the same since I use it to generate cover points and path finding
does the ragdoll need to look the same? i mean the mesh should not really block stuff
I want to make big corpses and be able to take cover on them, not for smaller ragdolls
Id lerp them to their final resting place once it comes to rest honestly, not during its time simulating.
like ATATs going down
Or try something like that to resolve it to the same place.
yeah that is a good idea
yeah I did try the lerping final resting place, when it's too divergent it looks quite off
a lot of people don't ragdoll big things tho, they have death animations
Yep
but its so fun looking? well is 60 fvectors a big load? probably 5x60 over 2.5 seconds
as long as they are unreliable
you only really care for the final resting vector
and interp the rest
yeah unreliable
i personally would not do it, but that is personal choice
If its a hero piece and your not expecting to do this X many SMs at the same time, might be a reasonable cost.
But yeah i wouldnt do that either
yeah, I don't expect there to be that many big mechs, but the game revolves around cover. The tanks do this but it's a lot easier with tanks because they don't ragdoll, just one box
i like to treat my network bandwidth as a precious thing ๐
As you should lol
ok, I'll keep an eye out on it then, will change to quantized too
seems at the border of what you would allow
yeah, but the best optimization is a death animation, could have multiple based on how it died
Yeah, let the impulse on the Server decide which Anim to choose
be nice if I had more animators to help ๐
๐คทโโ๏ธ
another option... don't constantly send updates for all bones. Update a few at a time and let client sim handle stuff in-between updates.
Might work well, might not. Probably worth trying.
@hollow eagle yeah, can do, I can change the update frequency too, it smooths to the new positions every sync
I create a collision from bounds of the actor and simulate ragdoll locally on each connection, it has some problems and not giving what you want (exact same simulation) but it works when you need close results
@peak sentinel that's a good idea!
might change to that and see since that's so cheap
thanks
Have you tried actually looking at how much bandwidth it draws?
Glad to helped ๐
@dark edge no, but I have the packet size and frequency so just going off that
@peak sentinel that works fine, but the bounds will be a square
meaning little gaps will not be passable
which might provide cover
yeah I figure I can make a temporary weird bounds box
the cover points have a grid width apart, so they're not 100% accurate
not FPS accurate, it's more for RTS pathing
I'd just send it unreliable and make sure you settle into the authoritative resting place and call it a day. The stock physics replication error correction can be pretty smooth if you tinker with it.
Is it possible to send a TArray<FMyStruct> in an RPC without it being const?
Reason being if I want to do something to that array on the server I have to make a new copy of the struct array there which feels wasteful
Oh so I can just send TArray<MyStruct> ?
I think the & was my problem
I was trying to send TArray<MyStruct>&
ah does it?
yeah
yep
Thanks
i forgot const once on a RPC param
and i had issues, been a while tho, would like to re-check to make sure i am not crazy
Man it feels so wasteful though ๐ฆ
Copying a big array
Even though it's already there
@fossil spoke maybe worth pinning this?
it is
You have a blog? Can you send it?
yeah but i have nothing on it atm
i moved server, never set it back up
might do that the weekend
๐
appreciate it Matt
Anyone here do a good referral? I am looking for somebody to integrate EOS or AWS for my project. Paid gig.
Use the Job Board
When i get my blog post, ill ask for that pin to be changed to the link, as i can provide more details
In here? OK will go there
too much mang
Yeah cant post there.
I'm reading through the FVector_NetQuantize stuff and they say it's only 20 bits per component. Is that saying each quantized vector only takes 20 bits of information to communicate across the network? I would think you would need at least 24 for 3 values, no?
@limber lodge did you follow #instructions ?
When bReplicateMovement disabled I cant use GetOwner()->GetActorTransform() on server RPCs because server is not aware of the updated transform, even while I set bReplicates(true); on my actor and movement component. I am not missing something right, thats how its should be?
it tells you that you need to message the bot
Likely wizards at epic doing some magic to crunch it down, also the point of NetQuantize, if it was 24 bits then you'd send a normal vector no?
yeah I cant follow the instructions lol:) It wont let me do the command to create a post.
Well thanks for the help. I will just run over to monster or some job site.
I don't think so because 24 bits would be assuming a uint8 for each of the x, y, z, but they are floats.
I was just saying that me personally, I would make a uint8 quantize with all 3 parts to cut down. I was thinking about trying to help the guy replicate vectors cheaper but even epic was able to do 20 bits which is less than I could come up with. So I was curious how they did that.
Likely by shaving decimals off the ends of the floats and combining that data somehow- magic indeed! You can see how they did it in the source I'm sure
Yea, I'm going through the source as we speak but it I am indeed failing to see the how they did it. Either way, it seems like using their solution is best. So 60 vectors at 20 bits a piece will give you an idea of your network overhead.
I wanted to help him out by simplifying that even more. I was thinking maybe you convert the bone locations to local space which would limit your float values to maybe the hundreds? Then you could get away with even smaller bit representations.
Then you could combine multiple values into one byte possibly
It would be incredibly complex but might cut down a ton on network traffic
uint8 is only 1 byte tho?
Right, so I was thinking if you can limit the range of the float you can split one uint8 in two for two values.
Or 3 even
you cant really use uint8
cause that would not allow negative
@steel vault did you look at WritePackedVector ?
Haha yea I'm literally on it right now
its really clever
but you cant use uint8 even if your doing this
unless you divide by a set number and can guarentee it will be less that 255
so you can multiply on the unpacking
Yea that's something I was thinking of doing
But also a uint8 is 8 bits, no? How the hell do they pack 3 floats into 20 bits lol
20 bits per component
Ohhhhhh
Ah packing more because local space is smaller. Maybe able to squeeze a bit there. Does unreal do compression per packet?
I was thinking one vector was a component
Thanks that makes way more sense
Iโm wondering if the bigger the packet, the more can be compressed per send
it depends on the entropy
* -Scaling factor (usually 10, 100, etc)
* -Max number of bits per component (this is maximum, not a constant)
*
* The format is <num of bits per component> <N bits for X> <N bits for Y> <N bits for Z>```
in fp you just sacrifice precision
what precision in floating points 
kekw
Sacking precision for floating points for bone locations to get a better ragdoll simulation sounds worth it
I was just saying marv that you could do your own form of quantization and pack more info in instead of using FVector_NetQuantize.
Does the scaling factor allow u to do that in the quantized already maybe?
They appear to use int32
What I was saying is you could use local bone space locations and try to get away with like int8
Yeah that sounds good
you could even do smarty pants things and do your own fixed point arithmetic
to do even a smarter packing
just take a look on how IEEE 754 defines floating point
and do a minor version of it
Yea I have yet to enter into the realm of optimizing my data structures like this, I was just spitballing. At some point though, I will probably end up trying to do some tricky stuff like this because I too have a lot of transforms to be replicated and will eventually want to ultra optimize.
A little afraid if bit representation on different cpus at that point. Feel like just losing precision is ok, and probably donโt need accurate rotations or velocities either, everything is pretty well constrained. I had to pack physics body velocities
that's called micro-optimising, and it adds tons of noise to the source code
"what the fuck is this" certified moments
Yea, I would have them off in their own files to prevent that type of stuff or comment it well, but it can be worth it depending on your scenario.
Lol
don't worry about this stuff, as you are defining your own FP minimal interpretation
so you would choose your endianness
the problem would be reading the content of types, but if you are writing directly on bits there is nothing to worry about
Ah ic, but doesnโt sometimes low bit mean high bit when u are using instructions to access?
yes, but your most significative bit will be always in the same place in your interpretation
you aren't re-implementing int
mainly because it is "your" interpretation
you decide where to write the bits
however the standard output will print differently depending the endianness of your final system - based on the container type
but since you are reading bits within positions you are fine
I think I get it. Going to make that a later resort though or maybe find an implementation of โsmall floatโ somewhere
k, been working recently in some compression algorithms for the CCSDS (Consultative Committee for Space Data Systems) standards, so I know this stuff ๐
If your local bone space floats go above 255 try int16
Yea you are going to be the person I come to when I have to work on this stuff myself in the future ๐
NOW... for the context of your game marvg
I would just recommed you replicating the first and the last stance within your ragdoll simulation
using net-quantize
I did try that vo, it doesnโt work well, interpolating looks funky when it diverges too much in the middle
then 3 snaps
3 is probably ok, Iโm doing 5 right now
I wouldn't expect that much divergence when replicating the first stance :(
but it happens... reeeee
First thing I did was set it up exactly the same so thatโs the first. Then I apply the same impulse to all the clients, then sync in between to keep the divergence in check
I think itโs not a lot most the time, but sometimes itโs very odd
Like maybe something got touched at a particular angle and caused a huge angular velocity
Yea that's why I wanted to cut down on his vector traffic so he could have the same amount of precision with less traffic.
have you tried different interpolation methods?
I can also clamp angular velocities of the body instances to help
I suppose you did
Yeah I tried a bunch even using blending with animation to the sync poses
It felt very non-simulated when u do that. I wanted the physics feel of things falling and bouncing
๐
you could also skip certain joints if you think replicating those is just unnecesary
Just a random question, are you replicating all bones or some of them? @cosmic trail
Gonna try clamping my velocities too, I feel thatโs when things can really diverge when it hits a joint in the right way to cause it to float off far
@peak sentinel all right now since joints can break off
๐
I assume you are also replicating rotations?
Yes
Yea so I do think you really need to optimize those structures so you can try to get as many updates as possible in.
Yeah will see what I can squeeze out. Thanks
There's a netquantizeNormal, 16 bits per component
yeah true, rotations only
no things like impact normals, normalized vectors
yeah but they mostly describe an orientation?
nvm, realize this as I'm actually trying to convert it
it can describe an orientation but not a directional rotation, since u can have many ways to arrive at that orientation
I wonder if it's enough for bone transforms tho, will have to see
Hi all, probably a nooby question but learning unreal (and how networking is done in unreal) right now, not new to networking in general. Question that's confusing me as to whether I have something set up incorrectly - is the "Print String" screen log shared by all connected clients? I'm playing in the editor as a listen server with one additional client. Have a "Switch Has Auth" on BeginPlay in the ThirdPersonCharacter blueprint (testing in the demo project) that just prints out "We have auth of objectname" or "We don't have auth of objectname" for each spawned player but instead I'm getting more entries in the log than I'd expect.
I'd assume that the game starts up, listen server client spawns in, prints out "We have auth of [character he just spawned] (167)", then the second client is launched, spawns in and the server should print out "We have auth of [client character (C_0)]", and THATS it as we have two characters, so EventBeginPlay should be fired (and prints out) twice. But the server is also displaying TWO additional logs, the print strings from Client 1? If this is how it works and logs are "replicated" (or just writing to the same log file on disk maybe?), is there a way to turn it off to just display the logs called locally?
@scenic horizon those logs are correct
Server and client both run beginplay, so client is going to print it twice (one for server client and one for himself), server will do the same.
so 4 prints there is 100 percent correct.
@meager spade Thanks for the reply. I'm a bit confused then, because what you said seems contradictory in my mind. If the client is printing it twice, why does the client show 4 logs?
Why does the clients window show logs printed from the server?
Interesting. I guess that clears it up, just I wasn't expecting the client to show logs that were exectued from a server. Do you know if this is just a debug thing in the editor?
yes it is
Like if I was to test on an actual network, it would only show the logs executed from that launched instance of the game (and not from all connected clients?)
correct
Cool cool, thanks so much. For a moment there I thought I somehow had twice as many players being spawned and didn't know why! ๐
np, happy developing ๐
I've been looking at aws gamelift. I've got few questions: should I use spot or on-demand instances.
Should I use Windows or Linux pricing? What is the main difference between them. (MAIN QUESTION)
thanks and please make sure to @ me if you reply or help me. ๐
- https://aws.amazon.com/ec2/spot/
- depends if you want to run on windows or linux...
Thanks I'll check the link out soon, is there a down side if using a Linux based server instead of a window? @hollow eagle
it's not an upside or downside, it's dependent on what platform you're familiar with
no one here is going to answer which is better, because the answer depends on you.
windows is more expensive due to licencing costs and higher resource usage, but may be "easier" to work with. Linux is... linux.
Ah ok got ya, thanks for the huge help. @hollow eagle
Question please. If I want to store really persistent data about a player beyond each game session. Is there a class I can use?
I know PlayerState allows for data persistence beyond the lifetime of a pawn but is there any that exists beyond the lifetime of the PlayerState. e.g I want to store player level, achievements, skins unlocked e.t.c.
And if I'm using external solution like cloud storage, is there any that can store unreal data types?
You're asking in #multiplayer so I'm guessing this is for a multiplayer game where progress matters and you don't want player levels to be changed by players
If that's the case, you need the UE4 dedicated server (and never the client) to tell a central server (that you will develop) about the player's progress, and I guess that server (using Python or something like that) will store the progress to a database
You won't be able to store Unreal types directly but UE4 can serialize to json, for example, which is easily processed in Python through an HTTP socket
@bitter oriole . Thanks. I see what you mean. It's the serialization to json that I was missing
@chrome quest An easier way that might work for you is to use Dedicated server, but use the built in Unreal savegame code.
I create a savegame per player and load it when they connect, and save it when they leave.
This way the native type serialization works just fine.
Someone?
But then you need to always connect to the same dedicated server, which is a bit dumb
true, but my savegame system also reads/writes to s3 directly
so it's not tied to a server
@silent valley, I was considering that also but then I didn't know what class will hold the save game for each player and how to recognize each individual player. Also, you'll need a save game to hold the save games and I don't think save games can store classes
Works too I guess. I usually advise against binary serialization, json is built-in for all UE4 types and is a lot more reliable and debuggable.
it's not perfect but it works for my game design which is more like Rust - persistent world where player progress IS tied to a specific server instance
fair enough, didn't realise json was an option tbh!
Yes they can hold classes - any Unreal reflected type really.
we mainly store inventory in there, so the items are all serialized into the savegame
savegame name is tied to SteamID
I'm sure Strangers solution is more robust and better for more gametypes, but we're a small team and it was quick to implement savegames
Wow. I didn't know that. Someone, somewhere told me otherwise
That they only hold primitive data types
not at all, to save entire player for instance:
FMemoryWriter MemoryWriter(PropertyData, true);
FSBSaveGameArchive MyArchive(MemoryWriter);
playerCharacter->Serialize(MyArchive);
there's lots of examples for how to do it
Though this means you serialize the entire player - any update adding UPROPERTY field is likely to break saves entirely
Very much not how I would attempt this
Like, this will also serialize basic replicated Pawn properties, for example
Or the components
@bitter oriole , @silent valley , thanks I think I can see a solution forming up. I'll bother you with more questions when they come up. ๐๐
Alright then
all other properties we recreate if necessary in the Serialize function
works fine, but I get your point about compatibility
Hey, what are you all using for server browsing? Is there something prebuilt to query the server for player info and such?
How to get rid of UGamestatistic:GetPlayerPawn(0) and GetPlayerController in My Map and Minimap manager which lives on the level as Actor?
This manager changes a texture of your map/minimap when you go to another location.
if you have some c++ involved
just make better accessors
a static function returning local player controller via GetGameInstance()->GetFirstLocalPlayerController()
hi, I just tried setting up a dedicated server for UE4 without having much knowledge about networking in the first place.
whenever I run the test_server.exe and open a game-client and type in "open 127.0.0.1" the server log says: "NotifyAcceptingConnection accepted from: 127.0.0.1:49191" etc.
and if I try to open another game-client and type "open 127.0.0.1" in that I get the same accepted message in the server, but from another port, and I don't see the 2 characters within the same game / server.
did I do something horribly wrong or am I just mistaken?
It will work on multiplayer with dedicated server?
ok
APlayerController* USolsticeObjectLibrary::GetLocalPlayerController(const UObject* WorldContextObject)
{
UGameInstance* GI = UGameplayStatics::GetGameInstance(WorldContextObject);
return GI ? GI->GetFirstLocalPlayerController() : nullptr;
}
basicaly that
UFUNCTION(BlueprintPure, Meta = (WorldContext = "WorldContextObject", CompactNodeTitle = "LocalPlayerController"), Category = "Local Player")
static APlayerController* GetLocalPlayerController(const UObject* WorldContextObject);
But can I replicate a location property of local PlayerController to a server so my teammates can see me on the map (I thinking to add this feature in the future)?
acess pawns via playerstates in playerarray
minimap requires no replication whatsoever
more effective pattern is
make an MinimapComponent
add it to the Actors that need to be shown on minimap
have the component register the Actor with the minimap system on BeginPlay
and then minimap system just displays Actors that registered
that way adding a say MissionObjective on the minimap is as simple as adding that same component on MissionObjectiveActor (just sitting on the objective location) and changing the icon on the component so it doesn't look like Pawns