#multiplayer
1 messages · Page 201 of 1
No one here knows what your game or that plugin is
No one can answer it with the little info you give.
{
NetMultiSetAimOffset(InAimOffset);
}
void UAGRAnimMasterComponent::NetMultiSetAimOffset_Implementation(const FRotator InAimOffset)
{
if(OwningCharacter && !OwningCharacter->IsLocallyControlled())
{
AimOffset = InAimOffset;
}
}```
I hate it
it's multicasted even
what does my Replay not like about this multicast
I mean, that feels like it should just be a Replicated Variable
And fwiw just the Pitch cause the rest should already be available
Which is what GetBaseAimRotation utilize in the background already
It's also what 99% of aim offset use iirc.
The AnimBP should have a node/function to calculate the rotation based on the Actor Rotation and the Base Aim Rotation
yeah probably, this is why I hate using any plugins whatsoever lmao
it always comes back to bite u with random stuff
still, it shouldn't behave this way in a replay
very confusing
but why does get BaseAimRotation go crazy as well
I don't get that either
how is the replication handled that it does what it does lol
I just wanna give up with Unreal and go to Unity at this point honestly
I always have the weirdest issues
Well at first I was trying to avoid sending StaticMesh pointers over the network, I wanted to make my inventory as light as possible since it will be used a lot.
So I'm wandering, is it worth it at all? Is the engine sending pointers over the network so it doesn't matter what value the pointers store?
is async loading screen any good for start up loading screen into game from lobby/main menu?
i need give variable team from lobby controller to game controller. but before event begin play
how can i do this?
LogTemp: Warning: DcsInventoryComponent: InvItem 0000043E98BE1280 was replicated on Client
LogTemp: Warning: AddToInventory: Inventory ending with 1 of the item
LogBlueprintUserMessages: [BP_Box_C_UAID_8C1D96959DA3BE0302_1463461103] Server: After add inventory 0000043E9B82F400 has 1 items
LogTemp: Warning: DcsInventoryInstance: ItemList 0000043E98BE1280 was replicated and now has 1 entries on Client
LogBlueprintUserMessages: [BP_DcsThirdPersonCharacter_C_0] Client 1: Inventory dump of 0000043E98BE1980 : 0 entries and contents reports 0 entries
First I see the inventory instance replicated to the client and assigned the address 0000043E98BE1280
Then the server adds an item to the inventory. and we see the same client inventory gets updated by replication. So far so good.
Then I go to print out the contents of the inventory and it reports zero items because it's using a different inventory at the address 0000043E98BE1980, apparently also on the client!
Why? There are apparently two copies of the inventory on the client.
For what it's worth, the Inventory object is a replicated UObject, attached to a very basic ActorComponent, attached to the PlayerState.
anyone know the event : """ event on swap player controllers"""
this event doesn work for me
Ah! Never mind! Just figured it out. I was using a NewObject call in the component's BeginPlay to create my InventoryInstance object. On the client, the object was first getting created with the replicated object, and then BeginPlay got called, which modifed the local copy of the Instance. The solution was to wrap the creation of the object in a check to make sure the pointer to the object was not already set.
this event doesn trigger for me
even when i seamless travel and switch game modes and controllers and launch in standalone
it didnt work -.-
i cant get this event run
i use this one but not sure what you are doing it
in game mode there is no event iek this
this event can maybe my solution
how does this event worsk?
oh it in character
its wrong event
im using this in my character to assign input, which i used to have on begin play but this is when the client basically gets his controller assigned if i understand this correctly
i watn this event run
in game mode
you will no video on tienrt yutbe
nothing
you will find nothing to this event!
its crazy
how can i know how it work now?-.-
probably in the documentation?
nothing
you will fid nothing
lets see if someone in this forum can gfet this event run!
in BP you wont get much info, you need to use c++ with MP anyways to get far and clean enough
Pretty sure a lot do. It calls if you Seamless ServerTravel as the Server.
As the comments suggest, the PlayerController Classes probably also have to differ, so it won't call if both are the same.
I cant for the life of me replicate this ive searched up the replication videos and they are no help... I attached a actor to a spring arm and it does not move on other screen please someone tell me how to fix this
Is the SpringArm Controlled by ControlRotation?
Cause that's not available to other Clients.
One is so Ig yeah
Yeah that won't work
Dang
Is there a way I can make it work?
It feels really good in game
and looks good
You can try setting those booleans to false and on Tick use "GetBaseAimRotation" to set the Rotation of the SprinArm
Can't promise that works though
What would I put in target? Would It be camera?
?
Nvm💀 Dont need anything in target ill test now
Yeah that doesnt seem to work
What's the result?
Nothing cant look
You disabled the booleans?
Yeah
Hm, setting the Rotation by Hand should work though. Can you show the code?
Yeah give me a moment gamebar takes forever to load
I tested it again and looked at both screens this time and its happening on the other client? but not the one your playing as
Its a mess
You can try splitting the logic fwiw
But it needs a bit more code
In your Character, you can override a function called OnControllerChanged.
That gives you the new and old Controller that possesses the Pawn (Character) and calls on Server and Client.
You can then use "IsLocallyController" to set the booleans you set to false to true again for the local Client.
And in the tick function, youc an use the same IsLocallyControlled, but this time the with FALSE, to set the WorldRotation of the CameraBoom by hand on the other Clients to the BaseAimRotation.
Alr ill try doing that
That works well now I have 1 more problem. The node "Get Base Aim Rotation" Seems to only work for up and down because other clients cant see it moveing side to side alrthough sometimes it does ill send a vid so you can see
Ah, right you are using Yaw of Control too
GetBaseAimRotation uses Yaw of the Character
Which is of course not moving
Yeah
You might need to add an extra variable then, to replicate the Yaw Float
Yeah
Switch has Authority -> GetControlRotation -> SetRepControlYaw
And then set the Condition of that variable to SimProxy only
Cause you don't need that to replicate to the AutoProxy/Owner
Alrighty
Server should have access to the ControlRotation
So You can just do that on tick with SwitchhasAuth
And then you can use the Pitch of GetBaseAimRotation + your custom Yaw
No reason to replicate yet another pitch
Alrighty
Like that?
I can't really read that properly. Please clean up your code
And it looks like you are adding more stuff than I said
Lol yeah prob should
The CombineRotators is wrong
You can "Break" and "Make" Rotators
You are only supposed to replicate a Float for the Yaw
Break the ControlRotation for that and set the Yaw value to your Replicated Float
And then break the Replicated Float and the BaseAimRotation, as well as "Make" the Rotator for the SetWorldRotation
And set the values as previously explained
Also make sure you don't plug the SetWorldRotation behind the SwitchHasAuthority
Only the SetReplicatedYaw should be there
Thanks! it works I appreciate you going through the steps for me and not just saying look it up it means a lot Thank you very much ngl I never though of doing it this way and you opened up a world of replication tricks that I can do now:) again thank you very much ill be sure to wishlist Evershire for you 😉
Ha, no worries. Glad I was able to help.
When I possess character to vehicle, the throttle input for the Chaos Vehicle doesn't work; only the steering input allowing the wheels to turn left and right, but the vehicle doesn't move forward or backward. However, when I switch to the vehicle's game mode, the vehicle spawns directly, everything works . What could be the issue?
Possess character to vehicle?
Wut
They probably mean switching from Char to Vehicle
Are you possessing the vehicle or attaching char to it?
On the server event pass in the controller and player for the enter vehicle
still same, only steering works the wheels are probably moving due to the animation, and the Chaos Vehicle inputs are not working correctly
Where's the code for the steering?
all inside car bp
I mean acceleration
I'm using two different Input Mapping Contexts I remove one and add the other, but it's not working this way
Where do you remove?
I only see add
Clear all mappings?
Might want to use get player controller instead of controller
yes when i interact the car
Try remove context and select the players context
yes i tried all different combinations in 3 days, i guess problem is something else
I think the overlapping actor loop may be a problem
i think not, i also try with overlap from carbp still same result, the car does not move
Anyone here using mover? Any idea when I spawn a client sided projectile that is being moved by mover it just spawns and doesn't move? Is this a bug or some kind of user error
Hey guys, what is Tranek document is talking about here? Is this just Mover of something else?
It literally says what its about, Network Prediction Plugin
NPP.
Yeah i thought they may rename it
It does said beta 0.1, do you use it Matt, what do you think about it
No I dont use it.
Its experimental
Very WIP
Same with Mover
Mover 2.0 is very WIP and still experimental
@fossil spoke i also have some multiplayer question in #gameplay-ability-system, if you can help i'll appreciate it
Ok let me start again,
Lets say client A has an actor (weapon) this actor has its owner as the character
is it possible, a late client B joins and has the weapon actor be replicated to him first BEFORE client B can see client A, leading to the weapon actors owner being null
Or are controllers/characters always within the first initial data sent to clients?
You can't know when an actor will be replicated. Ownership doesn't imply anything about when something will be replicated.
anyone in here recommend against EOS vs Steam? i like the EOS terms a bit better but maybe there's a third even better option when it comes to dedicated servers? would love any thoughts on this as im going back and forth deciding
Same here constantly having issues with steam ded servers
seems to have a much more dedicated developer documentation and tools but maybe im just being biased
EOS?
i'd love to have an opinion from someone who has used both
yea, from what i've been seeing
Likewise
i mean steam does too, but it's less unreal specific , for docs
i just want something i know i could trsut long term and i feel being that epic made unreal EOS just seems like the better option but i dont know how difficult integration between the two is / up keep et
U also having issues with steam ded servers?
kinda i haven't set one up yet, but after starting the steam stuff and getting that going ( i have the basic setup done ) i don't know if i want to continue w steam
especially after looking at the rev share distribution differnces
I've also been considering switching to EOS it also has crossplay support if you want to use EOS I would recommend taking a look at the EIK plugin it has host migration and other features exposed to bp
been actually looking into this specifically haha
it seems super well documented
good community
these are things as an indie dev i need lol
Yea 100%
hey guys, for setting up an Online Lobby system that uses Steam, do you use any plugins or do you just use the Online Subsystem in Unreal?
I am wondering what to use to create a system where you can join a lobby, play with people, lobby gets locked when the game start, etc
I saw there's some plugins on the Store that might save some time with this, but I wanted to hear what others are using
I was using the free plugin AdvancedSteamSessions but I have not really delved into it too much. I think I've seen that with these online systems you need to make Delegates to check things if you fail to join, manage to join, game doesn't start, etc.
yea advnaced steam sessions is what im using but personally thinking of switching. there's definitley lots of plugins and things to help w integrating steam but yea the advnaced steam sessions / sessions is definitely good and the guy that made it is super active in his discord which is a plus
why are you thinking of switching?
personally just think epic suits my long term vision more but also just want to try both and see what is geniunely easier for me to understand and work with
ah, so it's not that you are unsatisfied with, as much as that you are thinking of switching from Steam to Epic Games Shop?
lmao pretty much
i also just like that epic online services is made by epic which made unreal engine. just seems like a better play long term
There is no scenario in which you make more money by not being on steam
?? i think that's a bold statemnet but im open to being educated on why . steam takes 30 percent of all revenue , no ?
Yes, and I would venture to guess the steam represents about 90% of any game's revenue that is on both. Maybe more.
but EOS is cross platform so i could still put the game on steam ?
yea i mean im really just in it for the sessions and ease of integration
and authentication stuff but i know steam has the same
i think i just mentioned that epic's rev is more appealing, which it is, but yea less market share i guess but that's not really the whole picture, if you for example have in game transactions, this can be an issue w 30percent rev share
epic games exclusivity with alan wake 2 was a massive hit in profit on pc, steam is simply charging that much because they can, people dont want to buy games in different places, thats where steam wins for now
for now, very key point
Question for those that have ventured into the hell that is physics replication:
My current situation entails that I simulate the physics on the server, and pass the world transform of the authoritative object to the non-authoritative versions of itself through a replicated variable. Visually this creates a pretty decent result, however;
I now have a driveable physics based hover cart in the game and although it looks visually pretty smooth, the controls suck. When enabling the simulated network lag inside the engine, the hover cart responds pretty late already when using the average network lag simulation preset. With a bad preset it becomes a really bad experience.
So concretely my question; Is this the point where I consider simulating physics on each client, and sending that location data to all other clients except for the owning client? I believe this is what the "Replicate Physics to Autonomous Proxy" checkbox can be turned off for right?
The problem it would solve is having a much better control experience. I am just wondering what the drawbacks are, because there must be some
Why did you reimplement replicated physics to begin with?
I might not fully understand your question, but I reimplemented replicated physics because the hero objects are not pawns and don't have any kind of movement component that already took care of replicated physics. Everything is done in BP in case that is important
does the players array in gamestate always have the same order for every client and server?
should try the physics prediction optin in project settings
but if your game is co op or cheating isnt overly a big concern, yea just make the physics client authoritative
Okay, I am gonna give this a try then
May sound dumb but if I run as a Listen Server do I still have 3 instances? like a server and 2 clients where one is both server and client? I Ask because I am having some issues with an HasAuthority check, if thats true then I need to re think this.
I thought It would just be a server and a client where the server is just not running in headless, thats what a listen server was but I guess its more like play in editor where the game acts as both? Idk any one please confirm
There already is a physics replication system
It's been in the engine forever. As long as you don't need local prediction it works really well.
I don't understand what you mean. If I do nothing and leave physics turned on for both client and server, it will look horrible afaik
There's tunable parameters for the physics replication. The default settings are way too strict.
But in general, if you apply similar forces on both sides, the physics replication will keep them in sync pretty smoothly.
So if I use a fixed tick rate for the physics frame as well as just letting both sides simulate, without trying to correct from either side, it should keep them in sync?
You don't need fixed tick rate.
Basically the whole thing that you did with replicating out the transforms, that already exists. The engine can already do that, with much better smoothing than whatever you cooked up. It doesn't solve the prediction problem, but it does solve the syncing problem.
Right so if I understand correctly, I can just simulate on both sides and get the same result?
Similar result. Your mileage will vary on that. But if it's not the same, the replication will smooth it into being the same. You very much want to read over the parameters for the physics replication system.
Okay, I will go and do that then and see where I end up
It's basically simulating on both sides, with client being smoothed toward the server's results, hard snapping if it diverges too far.
Okay, interesting. Thanks for the extra explanation
@chrome bay sorry for the ping, do you know how listen servers work in relation to it acting as a server/client on same machine?
Listen Server is running server and client under same process
There's no "background" server or different game instance or anything
One of the machines will be both client and server, so yes authority checks may be weird, rethink it e.g. use GetNetMode()
Hey i was wondering, is it possible to transfer ownership of an actor from a character to another and is it usefull ?
Yes, the Server can change the Owner of an Actor to another Client.
I have a character than can put a ladder on the world, but once it is on the world i would like the owner to change so it is the world
So if the owner is null, it is like if i placed the actor in the world from the editor directly ?
Yop
Ok nicee, thanks !!
if i want a easily scriptable and replicated random value, how should i go about approaching it?
ideally i want just a node i can put it, that automatically replicates a random number. on server, node blocks execution of script until it receives a number from client / time expires, and it automatically generates one
the usecase for this is ability/general gameplay scripting
Hi, I have managed to get all of my movement replicated correctly, but after a few hours of trial and error I still haven't been able to make animations replicated.
I have an animation blueprint that transforms my vehicles bones (wheels) to either spin or turn when steering based on steering value and velocity. Even though I replicated the variables as I did for my movement, calling their update with a event run on the server, the animation only works on the server side.
autonomous proxy client correction looks like it can correct a rotation, in what circumstances might that happen ? thought player rot is client auth, or is that just if its controller driven
Pretty happy with this. Replicated 240 npc characters on remote dedicated server. Just need to optimize a little to keep it above 50fps. It's for a giant soccer game
If a person becomes net relevant, do 'On_Rep' functions get called at that moment for data with the 'ReplicatedUsing' specifier?
I'm using On_Rep to set stateful data in an ABP, and perhaps I should just be accessing that data and setting it every frame instead
it should
It will if the value is different from the default
Assuming you didn't change the notification condition
How do I make a player watch another player's camera view? For example, a character dies and his view then switches to that of another player who is still alive (of course, the player who owns the camera still has 100% control and the player who is watching will simply follow the orientation of the view of the player being watched). I wouldn't want him to be just a "free camera" in the environment
I saw that there is the Set View Target With Blend. If it is the solution for this case, what is the correct way to use it to achieve this result? I also accept other methods
you are correct but to be specific you probably want to do this on the server
as the server needs to know who you are viewing to set replicated properties like target view rotation in the default setup
thanks! I'll try
so, if I "Add impulse" to the capsule of a Player when he makes an input.. and I want it replicated exactly, as it will hit some Box, that can hit another Player capsule...
I would just in PlayerA: Input x&y & "PlayerState:PawnPrivate" reference -> Event Run On Server -> Event Multicast -> x&y with some forwarfVector etc to make the necessary vector for the "Add Impulse" and the "PlayerState:PawnPrivate".
Unreal will manage anything else?
and... is this the right way to set up the replication?
Anyone know if there's a way to get previous value as an argument to PostReplicatedAdd or PostReplicatedChange in a fastarray? like you can with normal OnReps?
so i can run some "unequip" logic on the previous thing before my "equip" logic on the new one
just the callback to run clientside on change events
store what the current value is outside of the fast array or on a non-replicated property you set
yeah, i can always do that, just didnt know if there was a nice builtin way to do it like regular OnReps have
your fast array should only deal with the items being changed
you should have an external manager handling the stuff
we only replicate the items, items add them selfs to the WeaponManager, weapon manager is in charge of what is equipped, etc
private:
UPROPERTY(Transient, ReplicatedUsing=OnRep_CurrentWeapon)
AShooterWeapon* CurrentWeapon;
UFUNCTION()
void OnRep_CurrentWeapon(AShooterWeapon* PrevWeapon);
UPROPERTY(Transient)
AShooterWeapon* PreviousWeapon;
UPROPERTY(Transient)
TArray<AShooterWeapon*> CurrentWeapons;``` we hold these in our weapon manager
privateeeeeeeeee? 🧐
yes
also should previous be a weak pointer just in case?
we were using it for multiple weapon slots, so an array of 4 equipped weapons or whatever, and then the slots just have the weapon pointers (if you unequip the weapon its destroyed anyway)
right but correctness sake an all that, plus the new GC kinda requires it done properly now
otherwise you'd need manually null the pointer
no i dont 😛
this will generally be contained inside the object itself so smart pointers to something you are inside of make little sense
assuming thats what they are doing
TWeak only makes sense when holding objects when a full chain of reflection can't be guarenteed
right but it wont be GC'd if its ref'd with new GC even if Destroy() is called because it wont null your stuff for you
Atleast thats how I understood it
I do that so much I'm surprsied fast array serializers don't have some way to get the owning uobject casted templated
thats not true
Actors will always be destroyed
World marks them as garbage
GC will run and null the pointers
if they are UPROP
unless i have something turned off
gc.PendingKillEnabled changed to gc.GarbageEliminationEnabled
as of recently
which is honestly easier to understand as a name imo
https://dev.epicgames.com/documentation/en-us/unreal-engine/objects-in-unreal-engine
If PendingKill() is disabled, MarkGarbage()will flag to the owner of the object that it wants the object destroyed, but the object itself will not get garbage collected until all references to it are released.
yeah that is the default, this is the new setup where you have to manually null your crap and it will yell at you
what is the benefit of that
epic seems to thing the old way was unintuitive somehow vs regular conventional smart pointers (beats me)
according to that twitter thread from years ago
we were using shared pointers like weakpointers with explicit delete stuff like Destroy or Mark as gabage, this way is more correct. A strong ref should stop GC, thats why weak exists in the first place
my personal excuse is that it makes GC need to do a bit less work
well with new reachability TObjectPtr stuff it shouldnt matter (in theory)
but that can also lead to subtle bugs
a lot of game code would need to be changed
i assume blueprints dont keep them alive
cause that would be a fucking disaster
yeah I agree it's very crazy to switch to it on any sizeable project
lol does bp even have weak pointers?
it will yell at you if you maintain any stale actor references (or uobjects) from the old world
I had to fix a couple mass bugs with it
It should have been opt in but maybe because you upgraded engine version
not really, soft object etc I guess is close but that's more about asset loading
apparently soft pointers ARE weak?
yeah exactly dif thing entirely
if it has any I would be surprised
the whole purpose is to reduce GC work?
no I think its to make it more correct, the TObjectPtr change and multi frame GC was to improve GC performance
I could probably be really annoying and @hollow eagle and see if he can shed some insight
The new GC mode? There's little to no benefit on perf
It's just to bring the unreal GC in line with every other GC'd language
yeah I was thinking "surely it's less work" but their comments seem mostly about consistency
with how someone from C# would expect it to work
etc
I can't think of another GC that lets you manually mark stuff as garbage and then have objects get nulled while still strongly referenced.
I'm so Unreal-brained I have no idea lol
It's only a problem for gameplay code because now people aren't used to dealing with it.
It wouldn't have been an issue whatsoever if it started this way
yeah because we would have been using weaks more etc
I suppose
If true, objects marked as Garbage will be automatically nulled and destroyed by Garbage Collector
I still feel like I'm missing something obvious here: when they say "nulled"
any insight about BP keeping references? #multiplayer message
You cant have weak pointers in bp so its kinda limiting no?
they mean every raw UProperty pointing to this gets reached out to and bonked to be nullptr (?)
How often do you really run into that though
Hey Vori! I'm trying to implement your killcam system. But I'm having a lot of trouble with the scripts that you included. It seems to be full of errors, and after doing my best to resolve them all, it doesn't work correctly. The article doesn't mention that the example scripts have all these issues. And was wondering if I could get a hand figuring out the Demonetdriver and the dynamiclevel duplication. I see that other people have gotten it working and am wondering if I'm using the wrong engine/Lyra version. (I'm on 5.2)
Soft pointers are weak anyway
so what maintains them after being loaded?
the reference to the uh, soft asst ptr etc
Not sure what you mean
I assume. whatever else you generally use that asset for
I might be mixing up soft pointers and soft asset pointers?
There's no such thing as a soft asset pointer
It's just soft pointers
And soft pointers are weak. With some extra data to store a path in the case of an object that isn't loaded.
They can be used exactly as weak pointers if needed.
So I have this StartAttack function. It is called from AIController (so from the Server, since only Server has this controller). I wonder what is the better approach - have the logic run on the Server version of the Character (like it is now) and then Replicate data down to clients, or simply convert the function to Multicast? Both work as intended, but I have a feeling that having it on the server is a better solution, tho not fully understand why (better anti-cheating and better sync?).
those are very different problems
What would be one way I can play random sections in montage but sync accross all machines
was thingking of just having a random seed but I will have to figure out how to sync at the start
bcause late joiners won't even be in the same section at the start
I don't think it make sense to call Server RPC on the AI controller
why would any of the client tell server to tell the AI to attack?
and if that'st he case, which player?
Just make the function get executed by the server
ye so basically what I did now
if that's in AI controller then that's not what you are doing
except that probably should remove RPC to Server
Server RPC is a mean for client to tell server to do something
if you want to execute something in the server by the server, you should not use Server RPC
actually I might still need an RPC
you just do switch on authority to filter the codes so the code only run on Server / client
Well this function is kinda universal
the BasicAttack function is on Character_Unit, which can be both AI or Player controlled
here I call it from AIController (or BTTask to be percise), so its naturally called only on the Server. But when I want to call it from Player Controller, then I would need a Server RPC no?
the act of showing the attack visually, and the logic behind what it actually does are different things and if this is doing both it's probably time to separate those somehow imo
thats what I had to do
to keep things fair you probably want the server to be the single place that actually does the "true" damage etc
better done as an onrep
imo
GAS montage replication is basically just a replicated montage + some timing information and a slot
it's a a bit complicated how it encodes the slot index but the ultimate result is just a replicated struct that says "play a montage here, at this speed"
I'm using AnimBP atm for Attack animation but will switch to AnimMontage soon, since I figured AnimBP is not very good for single animations
Well here's the whole function
What do you think can be done better in regards of networking?
I think that only server should be in controll of StartCombat, StartAttack and obviously DealDamage, no?
and then just replicate variables and multicast animations to the clients
why do you have to multicast the animation? it could just be replicated if there is only 1 montage at a time
how?
The code atm is run only on the server which is intended
I will rewrite the attack animation soon to Anim Montages, but again, I would still need multicast won't I?
lets say in this case
that will be played only on the server version of the Unit?
replicated variables are changed on all clients who the object is relevant for
of course the anim montage must be played manually on each client from something replicated, rpc or replicated property or whatever
oh, the character (Unit) is replicated, right
so Anim Montage that is played on Server Unit will be played on Client Unit too
makes sense
in my original solution I needed multicast because I needed a reference to the client specific AnimBP
only if the call to Play anim montage is FROM REPLICATION
just because you turned on replication doesn't mean the every subobject and every property is replicated, which is a good thing
and yes the client will have to figure out which anim bp it is from their pawn, component, whatever
Heyoo, hope you dont me asking but how are you managing the networking of that? In terms of weapons arriving before a player does or maybe the inventory replicates before the networked weapon get a chance to come over, how are you dealing with all that
Actually when I think about it, player can just get extra info like current montage time from the server when getting the seed number
that's more or less what GAS montage replication does, but I think something more project-specific can be much better
the goal is to get the same state, but you don't need to send over the entire "play this montage"
doing things atomically in one dumb struct and not relying on multiple properties replicating in concert generally works better in my experience
hey all 🙂 plz point me in the right direction if this is the wrong place
i've just build a dedicated server using the 3rd person template project. when i connect my clients to my server, all local, i get really bad latency. is this normal for out of the box? do i need to adjust some settings, or should two characters run around fairly seamlessly in this setup?
any chance I can have a ReplicatedUsing on a struct or no
there should be none, are you sure your PC can handle it and its not just a high CPU consumption causing low fps an lag?
shouldn't be. if anything my gpu is the weakpoint of my system. but both clients run themselves fine. and if i test through the editor with a couple of clients then it runs as expected.
apparently a bunch of my ram is being used. gonna reboot the system
yes you can, an onrep is fine there
ah, i've sorta figured it out a bit. when one of my client windows is in focus, the other is not updating properly. if i de-focus the client, the other is also smooth as butter.
can you give me an example please
UPROPERTY(ReplicatedUsing = OnRep_MyTeamID)
FGenericTeamId MyTeamID;
UFUNCTION()
void OnRep_MyTeamID(FGenericTeamId OldTeamID);
ReplicatedUsing="OnRep_XP" only works if thats a ufunction an structs cant have them
oh no on the struct
you make the ufunction in your class itself
oh you mean INSIDE of the struct, oof
yeah that's kind of not how replication works
it would be interesting to make callbacks per member I guess, but at that point you are getting into just wanting custom serlialization?
yeah I just figured since you can mark them explicitly Replicated or not with replicated being default
I figured that was the case thanks anyway
the simple thing imo would be to just write an onrep function inside of the owning uobject that passes it and the previous value to the struct function
and the struct just only compares that field
that's what epic does for the most part with the larger "wait there's actually different codepaths" struct onreps
see AActor::OnRep_ReplicatedMovement
it's of course custom serialized but the idea is that the received struct indicates what's actually on it as bitflags
which could be simple comparisons to the last value
not a great example I guess as it's not just a simple onrep of a default struct serializer type
note that FRepMovement implements its own equality == operator
this is to help figure out if it should be sent (on the server side)
How do I change the level for all players in the lobby and also change the game mode? I used advanced sessions plugin and it worked for changing map but there was no "options" output like in the "OpenLevel" node in the "ServerTravel" node. So I couldn't change the game mode with it. I also tried seamless travel but I didn't get how do i do it. How can I get it to work guys?
wait if I have an array of stucts do I only get OnRep_MyArray when the array itself updates and not members on the structs in the array that are also replicated?
I have a log actor spawned on the server and set to replicate physics on begin play. Not sure how the proper way to handle this is as currently getting a lot of stuck errors and jitter on the clients.
I figured begin play runs on all instances so these changes so the collision setup should be reflected everywhere.
Question about network authority. How I can "get" authority?
My situation: I work on player respawn. If player is killed, cooldown beings and when it ends player can press key and he will respawn (calling Respawn() on player character). Problem is it works only on server player, not client. On client engine complaints in logs:
LogController: Warning: Trying to possess BP_ThirdPersonCharacter_C_3 without network authority! Request will be ignored.```
I tried to run code on server: player presses respawn button -> `Respawn()` -> `SV_Respawn_Implementation()`
Where `Respawn()` is obviously on local client without authority and `SV_Respawn_Implementation()` has this signature:
```UFUNCTION(Server, Reliable, BlueprintCallable, Category = "Respawn")
void SV_Respawn();
void SV_Respawn_Implementation();```
But that does not help, `HasAuthority()` called in `SV_Respawn_Implementation()` is still false. I watched some youtube tutorials about respawn but they weren't much help. So, how I can do something on client that server will accept as authorative?
you never call the _Implementation function directly
you'd call SV_Respawn();
ouch, will rectify that
Thanks, it worked! 👍
Hi, is it necessary to replicate the Weapon Actor? For example, is it better to call the weapon firing function via RPC in the character or weapon script?
I can call server RPC functions only from the character script, but from other scripts I get an error of either no owner or no role if the actor has replication enabled
I don't know why that would be "better", also don't paraphrase errors
The weapon actor would need to be owned by the character or its player controller for server RPCs to work correctly
is it possible to change the NetServerMaxTickRate either when the server is launched or via an executed console command or something? I want to have a different value for different maps without having to package the server build multiple times
How should I make for TCP server socket to negotiate for port with the client? Is there a ready implementation, or should I create another TCP connection just for that
if you want callbacks when individual items in the array change, look into FFastArraySerializer
its a little tricky to setup the first time but its super useful
What's the goal here? multiple connections to one client?
It's my uh, idea that unreal kind of just does that for you
for the one ip net driver
Make sure the ticking dependency for based movement ticking after the platform is working I guess
The CMC needs to know which way it moved so it has to tick after the platform moves
From what I understand
Why I can replicate the activation of physics on the capsule but not to turn it off correctly? once I click "F" by second time I cant move the character
If you have a variable with a ReplicatedUsing, but it has already been updated to the new value with client prediction, will the notify still be called?
nope
the cmc should handle this itself in UCharacterMovementComponent::MaybeUpdateBasedMovement
FCharacterMovementComponentPostPhysicsTickFunction is what executes after the movement base moves
Yes. Exactly, I want to have multiple clients running on one computer
I notice if I have a static mesh actor with replicates movement and replicates static mesh movement everything looks ok when pushing the mesh around. However when the mesh say rolls into the player jitter can still occur, any fix for this?
Hi all,
I am making a closed-environment game where players have the ability to run superpowers (like adding delay to their outgoing packets, or so) by pressing a key in their game
What i want to do, is after pressing a key, the game should communicate with some other EXTERNAL program/software which contains the script to do as needed
First, I want to ask is this possible?
Second, can someone guide me into what direction to look at for this?
Thanks in advance,
Does a single replicated chaos vehicle really use 25kb/s of bandwidth when there’s only a single person in the server? That seems way too high to me
I have 1000 actors to "replicate" their locations and I have 2 possible options. Which option is likely more efficient?
Some context: I need the absolute most efficient method possible of replicating these actors. The actors themselves aren't replicated at all, clients spawn and move them on their own through prediction and a custom movement method I created.
Finally, there is an actor manager which is replicated that is in charge of feeding the clients their most recent whereabouts.
Option 2: Use Fast TArray Replication to store the locations of the actors.```
-# I could try both methods and figure out which is more performant myself but I'm really sleepy and it would take atleast an entire day to fully test both methods... I'm hoping someone might have some insight.
It's probably option 2
I really don't want to set that up though
the most optimal way would probably be using a custom UChannel class and streaming the actors locations through that, only when they change
I'm dying here. I am simply calling destroy on this weapon to get rid of the mesh and you can see my attacks change when I swap from equipped to unequipped however I can't get locally controlled clients to have the mesh destroyed. It destroys on server and replicated down but the only place I can't destroy this actor mesh is on clients like this. Anyone know how to destroy an actor that even me making a net multicast to destroy doesn't destroy it on locally controlled clients?
I'm building a swarm type game so they are almost always on the move, thats why I built a prediction system. The servers location only needs to be sent to clients every second to account for small correctional checks. That might be helpful information. I feel like making a new UChannel compared to a single actor that holds an array of locations would only give me the tiniest amount of difference? Do you disagree?
nvm I got mine
im trying to bind the OnComponentBeginOverlap event the following way :
- if listen server enters, call only OnComponentBeginOverlap on LS
- if a client enters it, call OnComponentBeginOverlap on LS and Client (whatever order)
i tried on begin play the following, but OnComponentBeginOverlap gets called on Client 1 when the LS enters the box
if (HasAuthority())
{
BoxComponent->OnComponentBeginOverlap.AddUniqueDynamic(this, &AJobLocationVolume::OnBoxComponentBeginOverlap);
}
else
{
BoxComponent->OnComponentBeginOverlap.AddUniqueDynamic(this, &AJobLocationVolume::OnBoxComponentBeginOverlap);
}
What are the simplest way to Test mp with builded Project? Are there some Tutorial for Host creating/ Client joining Game
If you can open ports on the host, you can use direct IP connection
Otherwise you'll need to either stick to LAN, or use something like Steam.
yeah I can open ports
this are only rough tests I want to do
under a more realistic scenario
in .h
UFUNCTION(Client, Reliable)
void ClientAnimation();
in .cpp
void AFirstPersonCharacter::ClientAnimation_Implementation()
{
static const FString ContextString(TEXT("Player Recoil Montage Context"));
FPlayerShootMontage* ShootMontage = PlayerShootMontageDataTable->FindRow<FPlayerShootMontage>(EquippedWeapon->GetName(), ContextString, true);
if (ShootMontage)
{
UAnimInstance* AnimInstance = FirstPersonMesh->GetAnimInstance();
AnimInstance->OnMontageBlendingOut.AddUniqueDynamic(this, &AFirstPersonCharacter::OnMontageBlendingOut);
AnimInstance->Montage_Play(ShootMontage->FP_Montage);
EnableSpray = true;
ServerAnimation();
}
}
How to convert this function into a template? Because in case of multiplayer, function name in header and in cpp are different and template functions are define in header so?
you cant make that a template
also very strange your doing animation with a clientrpc
oh
thanks for noticing
uhhhhhhh how big is the souce build of UE?? cause i continue to run out of storage while trying to build all of it
So, I'm sending RPC from client to server. I set Owner on the client, set SetIsReplicatedByDefault, but my RPC is not executed server side. Did I forgot about something? Actor's bReplicates is set to true. Did I forget about something?
yeah because you set the owner on the server, not the client
W8, so owner of the actor must be set to particular controller on the server, in order for Client RPC to run on it?
hmm maybe that's the case ? im just trying to package but how do i deteremine what i woul dneed? im just follwoing their own instructures. run the two scripts and then build shaders and then the actual UE
which instructions? you can either do an installed build, or a standalone (foreign) build
but native builds is what the big boy studios do
so if your project is under the engine root, UE5.sln has the game project inside it
and you just build that instead
then UBT can just figure out what you actually need, saving hours of compile time
but unrelated, I would have >=1TB SSD just dedicated to UE projects
i have a few of these
lemme send real quick to see if its the right thing
oh that tells you to use the dog water github desktop client and everything
but that's the foreign build setup
https://dev.epicgames.com/community/learning/tutorials/8JYW/setting-up-an-unreal-engine-studio-the-epic-way#projectfolderstructure doing it the native build way is still undefeated
is there any way to make a repnotify variable call OnRep if the value is the same on server and client
lmao yea i did not use the desktop app. but got trhough all parts but failed overnight cause i ran out of storage lol
yea i'll give this a go
i tried overriding the replication condition to true, but it still doesnt fire on client
void UPGPlayerStateRoutineComponent::PreReplication(IRepChangedPropertyTracker& ChangedPropertyTracker)
{
Super::PreReplication(ChangedPropertyTracker);
DOREPLIFETIME_ACTIVE_OVERRIDE(ThisClass, CurrentRoutineStateGT, true);
}
is there more to this? or jsut this bit about folder structure ? thought maybe it was a tutorial on building ue from source natively
DOREPLIFETIME_CONDITION_NOTIFY(MyClass, MyVariable, COND_None, REPNOTIFY_Always);
This should trigger the OnRep on the client even if it's the same value.
Hi guys, is it valid to change the client's walking speed in this way?
Doesnt work because on server its the same value
The server will evaluate the value to see if it needs to replicate it to clients. If it doesn't change on the server, it will never replicate to clients.
If the server does replicate the value, the normal behavior is to run the OnRep on the client if the value is different to what the client has when the new value came in. You can chance this by registering it with the always condition to always OnRep when the value reaches clients.
If the value doesn't change on the server, it will never be sent to the client, so the override won't matter.
So i cannot change de server evaluation ?
Why would you want to?
Changing the values 2 times to make it trigger the onrep sounde weird
If it didn't change on the server, why would it broadcast that it did?
Because i need some stuff to run on client
Hud stuff
Then run it on the client on Beginplay or the OnRep. One will be correct.
It isnt beginplay since its while playing
#cpp message Kaos done bulk of the work for you
Its already on the onrep, but i just told i got the issue
I guess the only solution is to edit the var 2 times
If you need an event to make something happen. Use an RPC. You don't use an OnRep to trigger an event if the value doesn't change.
faker
It is a way
not a valid way though
You want to movement flags that are replicated correctly
See FSavedMove_Character
shhhh
Just by curiosity, there is no way to override the server evaluation ?
Evaluation of what?
if a property has changed?
If so kind of, use a struct with TStructOpsTypeTraits with WithNetSerializer = true;, now its up to you to pack the data into the archive and determine what gets sent when.
It wont replicate however unless it can see a value has changed (this means atleast one value must be reflected so it will call NetSerialize), you could have a single int act as a key and whenever you want it replicated just MyKey++ and now it will send any data in your NetSerialize function
The server will evaluate the value to see if it needs to replicate it to clients. If it doesn't change on the server, it will never replicate to clients.
for your first sentence, is there any docs§/example on how it works and set up ?
^^'
USTRUCT()
struct FMyStruct
{
GENERATED_BODY()
public:
UPROPERTY()
int MyKey = 0;
// This is explicitly marked NotReplicated, this is because in our UObject we are replicating the whole struct so all members besides explicitly
// marked NotReplicated properties will not replicate, so if you need it to be reflected for BP access but not to track for networking do this
UPROPERTY(NotReplicated, BlueprintReadOnly)
int a;
float b;
bool NetSerialize(FArchive& Ar, UPackageMap* PackageMap, bool& bOutSuccess)
}
template <>
struct TStructOpsTypeTraits<FMyStruct> : public TStructOpsTypeTraitsBase2<FMyStruct>
{
enum
{
WithNetSerializer = true
};
};
inline bool FMyStruct::NetSerialize(FArchive& Ar, UPackageMap* PackageMap, bool& bOutSuccess)
{
// Note how we replicate these ourselves even though they arent being tracked by unreals shadow state
Ar << a;
Ar << b;
// Just make sure we send the key with the new data
Ar << MyKey;
bOutSuccess = true;
return true;
}
// On your UObject/AActor its just
UPROPERTY(ReplicatedUsing=OnRep_MyStruct)
FMyStruct MyStruct;
// now the only time MyStruct is considered *changed* in unreals eyes is when I do this on the server
MyStruct.MyKey++;
If you wanted slightly better perf you can make it do a Push based replicated and have a IncrementKey function that increments and marks the struct dirty on the uobject
Note this was all typed here so I have no IDE syntax
could be a typo or two
thanks a lot
so here, a and b wont replicate ?
i quite didnt understood the "NotReplicated" part
okay, a and b are replicated "by us" so we need to flag it as not replicating
The problem is that people who enter my session when it runs are flagged, as if the speed of the client did not match that of the server.
That's why I said it is a way, but there are better ways. But it really depends on your knowledge level, if you can get into C++ you can customize the compressed flags in the UCharacterMovementComponent, if not this is fine too
// Bit masks used by GetCompressedFlags() to encode movement information.
enum CompressedFlags
{
FLAG_JumpPressed = 0x01, // Jump pressed
FLAG_WantsToCrouch = 0x02, // Wants to crouch
FLAG_Reserved_1 = 0x04, // Reserved for future use
FLAG_Reserved_2 = 0x08, // Reserved for future use
// Remaining bit masks are available for custom flags.
FLAG_Custom_0 = 0x10,
FLAG_Custom_1 = 0x20,
FLAG_Custom_2 = 0x40,
FLAG_Custom_3 = 0x80,
};```
That's your golden ticket
Or try Mover 2.0
Yes its replicated by us, no we only need to flag a value if you want it to be a UPROPERTY like if you wanted a pointer to not get GC'd or if you wanted a variable to be exposed to bp then we need a uprop specifier but we trick unreal and say "dont worry about replicating this value"
and then we tell unreal with the type traits template struct that when it comes time to serialize our struct dont do it your way by checking reflected properties, just let us have the buffer (the FArchive which we write to) and then we populate it with the data we want and send that over the net in the form of just a "blob" of bytes that represent our struct,
then when the client receives the update, it sees we use our own NetSerialize and calls that again with the FArchive passing us back the blob of bytes, which we then write into the variables on the struct
If i wanted to have servers of my game hosted through a linux docker container, does that mean I need to compile the server build in a linux environment or can I get away with it some other way like using clang on windows?
Your container has to run Linux so you would need to build for Linux
how do I check if a connection string is valid, ie check that it's a valid listening server? when using ClientTravel
I think an apporach for this is using online beacons https://dev.epicgames.com/documentation/en-us/unreal-engine/using-online-beacons-in-unreal-engine
Online Beacons provide a mechanism for lightweight interactions between servers and clients in Unreal Engine.
Hi everyone! I know this might be a common question, but I could really use your help. There are so many tutorials on multiplayer development out there on YouTube and Udemy. Can anyone recommend a good tutorial to start with? Thanks in advance!
read the pins I guess
People don't notice this place, maybe should be pinned as well
(talking about that page specifically)
I can point to that page specifically in the pin for the doc fwiw. But I wouldn't create another pin for it.
Thank you so much, for pointing the page out. I also missed.
I have a multiplayer game and I'm spawning some NPCs. Each time an NPC is spawned (from the game mode) the AI Controller begin play is triggered, which it shouldn't. Why is that? I'm doing here something wrong?
Because you're calling SpawnAIFromClass which will create a new pawn with a new AI controller
Begin Play is being called on a differnent/new controller
Thank you! Indeed, now it's calling if I use the Spawn Actor from class. I know the next question is related to #gameplay-ai but I'm going to ask here since it's also with multiplayer. So, the AI is spawned now, but the BT is not finding any other actors (after the first round was killed and now respawned).
The first pic is how I respawn and the 2nd is from the AI Controller. Should I run again the BT? Or not? The perception event is not triggered again.
Edit: I forgot to posses the Ai to it's controller.
Hey friends I'm using party system and party owner hosting the party members in his own session.
When i try to join the dedicated server using servertravel url:port the error im getting is
ERROR: The map '8a386d6bb0.net:32152' is either short package name or does not exist.
recognized: servertravel 8a386d6bb0.net:32152
Also I've tried to run command on server from controller same result
How can i transfer the whole players then ?
Thanks in advance
Hey, i have a voice chat in my game but the gain is either too low or saturating, do you know how I can get a good result with the voice chat for all users ?
"servertravel" is meant to have the server move to a new map, not to connect to a different server.
Excellent friend, I'm going to investigate it. With C++ I created the session system so as not to use the advance system. I don't know much but I can learn. Thanks!
Hi everyone,
I’m encountering an issue in my small local multiplayer project. When launching the game, the first player (usually the host) is never controllable, even though their 3D model spawns correctly (launching in Standalone Game as Listen Server with 2 players).
I’m using a custom Game Mode Blueprint and have set the default pawn to None, as I handle possession myself within the Blueprint. It seems like the problem might be related to the default pawn setting, but I’m not entirely sure.
Has anyone experienced a similar issue or can point me to relevant online resources? I’ve seen similar problems discussed on Unreal forums, but they were never resolved. I included my GM blueprint in case something was obviously wrong to some experienced people.
Thanks in advance for any help!
Ops i thought its travelling to new server xD when i use open the host opening normally but the client stuck in transition map
You can't have the host move everyone on the listen server to some other server. Each client would have to move to the new server separately.
@sinful tree Ok thanks I am trying to move the whole party to the dedicated server .
Is it possible to using multicast event fires on every client to use open command ?
or which way is better ?
This probably won't work well as you'd be telling the host to move too without guaranteeing the clients have received the message to move and then they could end up disconnecting from the host since it's effectively ending its session before they receive the message, thereby they don't get it and do nothing other than disconnect from the host.
Having the client not connect to the host at all and using a party online subsystem to communicate what is needed to have clients connect to the dedicated server when needed would be best.
Essentially, players stay as standalone games until they are ready to connect to your dedicated server.
hmm but We have party owner hosting the party player in his listen server for entertainment till the matchmake find a server to travel thats the idea .
Hey does anyone have advice on how to debug connecting to a dedicated server?
I have my server executable running on my dedicated server with an IP address that I know is accessible.
I then run from blueprint "Execute console command : https:IPADDRESS:7777"
This works for debugging locally but not remotely. Any ideas of how I could start debugging the connection?
The console command should just be open ipaddress:port
since my pawns will never get destroyed, should i move some playerstate logic to my pawn since all playerstates are always relevant ?
i dont know how impactful are many playerstates holding data
because there is some data that the PS holds that other players shouldnt care about
Worked like a charm, thanks!
hi, is it possible to make a replicated property for an actor class NOT replicated for a child? I'm specifically looking to make AActor::bHidden not replicate
Override AActor::PreReplication and use a DOREPLIFETIME_ACTIVE_OVERRIDE to change it to not be replicated.
DOREPLIFETIME_ACTIVE_OVERRIDE takes a bool, true to replicate, false to not.
thank you!
there is also DISABLE_REPLICATED_PROPERTY
ooh ill look into that too, thanks
and one that helps it apply to private parent class properties
is there some way to get a client-side event after a player has fully spawned in? I am trying to update some gui code after the player has fully loaded in
I tried putting some code at the end of the actor's beginplay event, but it isn't seeing all the pawns
You could bind to a pawns possessed event, it really depends on what you define as "fully spawned in"
I needed all the pawns completely loaded (they all need to exist so that each of them can build a list of the other available pawns)
I figured out a hacky way of doing it, which is fine for now
Your best bet is to use a combination of some central manager and beginplay
That's also the cleanest way
There is no "everyone spawned their pawn" event
just hacked it for now to have every pawn inform every other pawn on spawn, lol
works, just stupid and inefficient
What you can do is:
- Create a ManagerComponent (ActorComponent), or, if C++, a WorldSubsystem
- Add a Register and Unregister Pawn function, an Array of pawns and two Delegates/EventDispatchers, for each event one
- Register would add to the array if not already in and call the first delegate (e.g OnPawnRegistered), Unregister does the opposite then
- In your pawns BeginPlay, get the Comp/Subsystem and Register the pawn
- In your pawns EndPlay, get the Comp/Subsystem and Unregister the pawn
- Afterwards you can get the Array as an initial list and use the two Delegates you can bind to to react to the list changing
That's one of the simplest setups and you have a nice central place for future systems that might also need to know about the pawns being valid
@charred island
thanks!
my current problem is my pawns not spawning on the spawn point, instead on the origin
but only in the packaged game
ugh... I swear I've had this problem before
Player controller id is always the same on both client and server, right?
im still interested for some advice
What logic?
what job they have, the state and location of it
the current routine and personal state
if they are sleeping
each player doesnt care about this info of another player, its only for the server
The question is what’s the data? Is the related to the pawn specifically or the character as a whole
pawn isnt destroyed (only at logout i guess)
so PS lifetime = pawns lifetime
The thing is, having data in the player state have several advantages, like e.g. you can move it between servers
so i guess i have to keep it on PS because the PS is restored in login after a brief logout
And having it in pawn makes you closed to some changes, e.g. you can't switch pawns or destroy it, if something in your vision of the game changes
the whole game is on 1 main map
yeah
i just dont know if having 20 PS with replicate data ALWAYS relevannt will affect perf
I mean, you technically don’t have to, you can override that functionality for postlogin an logout where it saves and applies old states to reconnecting clients.
Use whatever is most appropriate for the data you want replicated
It depends more on how many replicated vars those actors have
the PS doesnt have itself replicated data, its on the components
for now i only got a few bools and ints , multiple gameplaytags, ptrs to PS, Pawn, GS, custom structs
most of those are on notify
so for now its not much ig
hi all, if I spawn a replicated actor on server, then set a replicated property on same frame, will client fire the onrep function when they spawn the replicated actor?
in C++ if it matters
As long as the value you set is different from the default value, yes
In a large scaled MP game where all weapons are projectiles with various speeds, how would you guys go for an optimized projectile system, would you just do your own from scratch or optimize the PMC ? I remember having a conversation with Jambax about the projectile system from HLL but it was maybe 2y ago.
IMO, do your own
server travel issue :
when testing in standalone , server travel works just fine , but in packaged build , it doesnt work at all , any fix for it ?
Do you remember how it was done in HLL ? (I know you said it maybe 100 times but I can’t find our conversation 😄)
ticking world subsystem updating all projectiles, no actors
projectiles are just line traces, nothing more
Hello, I’m connecting to a dedicated server using the open port command but it’s sending my clients to the game default map instead of the server default map. Does anyone know how to solve this?
same as a game I worked on, pre-subsystems though
and is the map you're travelling to packaged?
not sure why the LoadSelectedLevel RPC doesn't just pass the level name though
but I don't have the context on how your level select works
Alright that’s what I was aiming to do anyway, thanks.
a widget basically that displays maps , player can click on any map and then the map id is passed to a variable , then the var is used in the execute on command
do other players see the selection or something?
but the likely issue is not cooking the map
each player calls his own widget , but the selected map variable is passed in one var for the server to travel to
so cook the map before attempting the travel ?
the load map function in made through interacting with an actor and pressing E
wel i did include it yes
game mode
uh yeah, the game mode doesn't replicate either
well ive tried it in all modes and it works
even in standalone
no the map widget shows for the owning client
yeah, trying in singleplayer mode or something?
not sure why you're debating
game modes don't replicate
widgets do not and cannot replicate
no not debating just saying the implementation i have works in everything but packaged build
a server RPC needs to be called through something replicated that the player owns
like their player controller
or pawn
yes , the widget is called through player controller
what is this BP
the game mode bp
and what calls LoadSelectedLevel?
an actor
also "execute on server" won't do anything since GMs aren't replicated
1 sec
what actor
how would someone go about making something like this
Can a separate player controller interact with a UI on the viewport?
Or better question, do new or added player controllers see the same viewport
You can have multiple controllers on the same machine supporting multiple simultaneous players. Do a search on "unreal local multiplayer" to get started
that kinda makes sense, except making the GM event an RPC
so does your print message actually show up for the server player in a packaged build?
did you verify the map actually ended up in the build?
well specifically for the host player?
it's a server RPC afterall
only the host player will see it
Whatddup, anyone knows why APlayerState::ExactPing isn't zero in PIE with PktLag = 0?
well so far in the standalone , its does show only for the host yes
well that's expected
I'm more talking about a packaged development build
if only this was code so you could actually use breakpoints in packaged
indeed
but at this point , when testing with host alone , on a packaged game , it should work
i will try , thank you for you time ❤️
Because packets will still be delayed by at least one frame
Ok that makes sense. Yeah the value exactly matches one frame. Thank you!
kind of a longshot, but does anyone know if there's a way to force predictive interpolation from the client to the server?
What is the best way to negotiate port for TCP connection?
"Negotiate"? What do you mean. Most network connections are sent to a fixed port on the remote and use a random port chosen by the operating system on the local
I have some data sent by TCP socket. I want to have 2 clients to be able to run on the same computer
Talking to each other?
Nope. I have a server, that is talking to the clients
Then yeah, pick a port for the server to listen on and don't try to specify the port used by the clients.
Single listen port on a server can handle connections from multiple clients at the same time
What about distinguishing 2 clients communicating from the 1 computer. From what I know, unreal does it by assigning 2 different ports
Yeah. The ports used by the clients are randomly chosen
The networking libraries handle that for you. It's not something you do by hand
Only the the port the server listens on is chosen by you
when would you use "skip owner" on a replicated variable? I just saw someone handling lethal usage that way that a bool variable "usinglethal" is set to skip owner and he sets it locally and on server seperately right after another. I don't see the sense in this, as it would be much more simple with setting it on the server and then that one sets the repnotify like usual
I would only use "skip owner", if it's an info I don't want the player himself to know but setting it on the server and the client both?? Maybe someone can bring light into this xD
ChatGPT says this and it makes sense now, if anyone can confirm that this is indeed the best way to handle this, I would be glad!
please don't use gpt 
"skip owner" is only is relevant server->client, of course the client can set the variable
the owning client just won't receive any updates for that variable
How to make the firing player's shot effect be created immediately, i.e. without using the server RPC, while other players get the effect through the server RPC?
To make a call to create an actor locally at the same time, and via RPC, it will not work, since the actor will simply be created 2 times
Yes I understood, but is it a good approach in that case with throwing a lethal?
locally and via rpc but without the owning client
How is that?)
maybe a multicast that checks that it's not the owning client at the start of it
I have literally done the same thing now, but it doesn't work
I also tried to pass ACharacter, which started the script execution, but it doesn't work either
what do you mean by, it doesn't work?
what part doesn't work
What's the best way to determine a listen server's own player state?
this sounds like game-specific behaviour now, but if the local client doesn't need the server to update them on something, then sure, use COND_SkipOwner
okay, thank you
well the player controller owns the PS, so IsLocalPlayerController on that?
If I write !IsLocallyControlled is performed by everyone, and if I write IsLocallyControlled, it is performed only by the client who launched the RPC
Nevermind.
so if you say, !IsLocallyControlled then even the client himself performs it?
Yes it is. I'm doing a check in Multicast. In this case, the code is executed for all clients
And on the server
If the check on the server RPC is the same
Hi, I'm trying to switch from a floating pawn movement component to the new Mover Character component introduced in 5.4 but I have a BIG issue.
Many of my movement calculation is based on the fact that my base sphere rotates on itself (using a set world rotation atm).
And I can't find a way to Queue a Layered Move that makes my character rotate in place.
Does anyone have an idea ? (or at least some documentation) Thanks a lots ✨
(I may mention that I'm using BP atm 😬 )
Hi!! Is there a way to synchronize multiple VR headsets using a single PC? I need a multi-user experience where people watch the same 360 video..thx for your time
Hi all ! I am looking for technical information about unreal networking. I have found a probably outdated document here (ue3) https://docs.unrealengine.com/udk/Three/NetworkingOverview.html but I can't find something for UE5 that goes as deep or deeper into the networking architecture. The documentation in https://dev.epicgames.com/documentation is very high level : more a user guide than a technical reference guide
I found a good resource recently...
UE4 Networking
Not all that much has changed since ue4, I expect.
So I'm trying to save & load character data from an SQL database and can save and load the player location without issue, however for the player rotation, it doesn't seem to want to set the player's rotation.
In the gamemode class I'm doing:
if (Controller->GetPawn()->HasAuthority()) // Ensure it's running on the server { Controller->GetPawn()->SetActorLocation(NewLocation); Controller->GetPawn()->SetActorRotation(NewRotation);
However, it is only setting the location and nothing happens for the SetActorRotation.
So my question is, how do you set the player character's rotation (not the camera since this is 3rd person) in a replicated environment?
For reference here is the entire function responsible for loading the location:
`void AMainGameMode::LoadPlayerData(const FString& JsonResponse, APlayerController* PlayerController)
{
if (AMainPlayerController* Controller = Cast<AMainPlayerController>(PlayerController))
{
if (FJsonObjectConverter::JsonObjectStringToUStruct(JsonResponse, &Controller->PlayerData))
{
FVector NewLocation(Controller->PlayerData.xloc, Controller->PlayerData.yloc, Controller->PlayerData.zloc);
FRotator NewRotation(Controller->PlayerData.pitch, Controller->PlayerData.yaw, Controller->PlayerData.roll);
// Log the values being set
UE_LOG(LogTemp, Warning, TEXT("Setting Player Location to X: %f, Y: %f, Z: %f"), NewLocation.X, NewLocation.Y, NewLocation.Z);
UE_LOG(LogTemp, Warning, TEXT("Setting Player Rotation to Pitch: %f, Yaw: %f, Roll: %f"), NewRotation.Pitch, NewRotation.Yaw, NewRotation.Roll);
// Set the actor's location and rotation on the server
if (Controller->GetPawn()->HasAuthority()) // Ensure it's running on the server
{
Controller->GetPawn()->SetActorLocation(NewLocation);
Controller->GetPawn()->SetActorRotation(NewRotation);
// Log the final values
UE_LOG(LogTemp, Warning, TEXT("Final Player Location: %s"), *Controller->GetPawn()->GetActorLocation().ToString());
UE_LOG(LogTemp, Warning, TEXT("Final Player Rotation: %s"), *Controller->GetPawn()->GetActorRotation().ToString());
}
else
{
UE_LOG(LogTemp, Warning, TEXT("Pawn does not have authority to set location and rotation."));
}
}
else
{
UE_LOG(LogTemp, Warning, TEXT("Unable to convert JSON to UStruct for PlayerData"));
}
}
}`
Is listen server worth doing? What's the downside to emulating "listen server" by firing up a local dedicated server? Having a player that is server is complicating some code.
i want to run some logic in HUD when the Pawn exists, and some other logic in HUD when the gamestate exist
to be sure to have the Pawn existing for the HUD, i made the Pawn get the HUD on Posses/when the controller is replicated to client
but for clients i get a race condition where the gamestate doesnt exist (which is weird ?), how would i know when the gamestate exist ?
The GameState always exists after BeginPlay is called.
If I need to have a unique id for a projectile or damage to be send over the network. Is Guid the right choice?
Sure, though typically you would come up with some management system that would just allow you to use an integer.
I will have to think deeper 😅. Thanks
Guess I can just associate projectile with the caster so the client can just generate its own int and increment it self
now for some reason in my controller, on beginplay, the Enhanced Input Local Player Subsystem is null
Real dumb question, but I can't think of a scenario right now. Can anyone give me a specific scenario with a ReplicatedUsing/OnRep function where they take in the old value (parameter) and use it. I know it can be done, but I haven't used it and cannot think of when I would want/need to haha (I don't need code or anything, I'm just going crazy overthinking it trying to think when I would want it).
It sounds silly to emulate dedicated server for listen server. It's a real option? Listen server is technically serverless so it doesn't make sense to emulate this with a dedicated server. It would be handy.
I just mean, why use listen server when starting a server in the background and joining it accomplishes the goal without weird listen server logic.
I think that background server would be a dedicated server. In real life they won't have this emulation and this wouldn't work so yo'ure just writing dedicated server code with this option.
Exactly
Whether the server is localhost or not, I can reuse the same code. My intent is to have dedicated servers anyway.
If you need to do smaller serverless games then do listen server (extra coding complexity), otherwise just do dedicated server (extra setup / costs). I'm not sure how well listen server works but maybe okay for co-op situations or RTS but they have to be short matchups because if the listen server disconnets it's game over for everybody.
I have clients current weapon represented in an enum slot, when a client swaps weapon it replicates to all, the time the enum reaches other clients and OnRep is called, it auto changes my "currentSlot" variable to the latest, I then assign back the old value in the OnRep (for proxy clients) and then call SwapWeapon passing through that enum value that was just sent to me
Thats just one example
There is a reason its optional to take the old param, sometimes you need it, sometimes you dont
Ah ok I think I can see some other times to use haha. Yea, I have managed without using it so far, but once I got distracted trying to think of a hypothetical I couldn't come up with one lol.
What's the best way to get a repnotify when a replicated array is updated? (cpp)
I've heard conflicting things.
Best way is to use FastArray because you get events for elements being added and removed
Otherwise you just get OnRep my array has updated, not telling you what in particular
Does RepNotify work when arrays are updated?
Yes.
You might have network timing dependency issues depending on what the array elements are, like an array of Actor* might not all be resolved when your arrays OnRep is called, I only mention this because the more elements of that type in an array that need to be network addressable, the more dependencies you create, it can be a pain and something to be aware of, its really on race condition stuff when a late client joins or whatever and we're in the middle of everything being setup and mapped locally (the NetGUIDs, and local spawning of the replicated actors etc)
i bought a map/level
but when i move a single mesh the whole foliage scale up and get destroyed.
what can i do?
I'm trying to enable and disable iris at runtime.
following the documentation here.
https://dev.epicgames.com/documentation/en-us/unreal-engine/introduction-to-iris-in-unreal-engine
said i can toggle it with the command line.
but do i need to call it for both dedicated server and client. or calling it on a server would suffice
is there any additional setup that need to be done before switching ?
Iris is an opt-in replication system for Unreal Engine. Iris supports robust multiplayer experiences with large interactive worlds and high player counts.
as a newbie in unreal engine multiplayer, if I want to implement host migration at some point in the future, should I be doing anything differently right now to make it easier to implement in the future? I found this plugin: https://www.unrealengine.com/marketplace/en-US/product/host-migration-plugin?sessionInvalidated=true
Honestly, newbies should not attempt host migration in Unreal! I actually don't know anything about that plugin, but I'm sure they probably have some Best Practices if you do decide to attempt it.
Ideally, make the sessions short enough that you don't need to worry too much about the host leaving.
if i wanted to do dedicated servers, which services are the easiest to set up if you have any experience? Azure, AWS etc
Dedicated servers are also tricky because you need to use a Source build of the engine.
I rolled my own solution using AWS sdk and python, but that's for a long running server.
If you want a session based system then something like Playfab, which spins up instances on demand, is probably your best bet.
I'd strongly recommend using Listen Server if you can though and avoid all this.
so basically my game is a 2 player russian roulette type game similar to buckshot roulette. So yeah i can just put those two players in a p2p lobby. However, in order to put some lore into the game, i want to have a multiplayer hangout room where around 8 players can just walk around and engage in simple interaction with each other such as rock paper scissors and other minigames.
given that the dedicated server part of the game wont be too complicated, it should be doable right? I have a cs degree as well but not much experience in web services tho
Simple question about initializing a reference to my PlayerController in my BP_Player class. On begin play I call an event that casts to my PC class and stores it as a reference. This seems to work for the Server and Client player, however when I print the reference on tick just to verify the values I see it alternating between the correct references and null values... Why might this be happening?
The dedicated server part sounds simple, but there's a whole load of work you need to do to just make a dedicated server, including downloading and building the engine from source. See this link for example: https://aws.amazon.com/blogs/gametech/unreal-engine-5-dedicated-server-development-with-amazon-gamelift-anywhere/
But given your current design doesn't require lots of state that needs saving/syncing when host migrates (this is the difficult bit of host migration), maybe you could use the Host Migration plugin. At the very least it should be fairly automatic in keeping players together when a host disconnects.
Do you have more than 1 player?
PlayerController is not valid for remote players, but the pawn is.
So the Client will create a pawn for 'server', but will not be able to find the PC for that pawn.
ok thanks for the advice
I'm testing on a listen server. The purpose is to store a reference to the pawn's PC so that I can update widget values for each player.
It appears to be working when I test it and update widget values for both the server and client, but I also get "Accessed None" errors to the PC as well.
like I said, the Client will create a pawn for the server but the server PC reference will be null.
Okay, so this would be normal to see? The way I understand it is that Client should always show a non-null reference to the PC when printing it out, however the server should show it's reference when printing from the server and null when printing from the client. Thanks for bearing with me, new to multiplayer concepts so just trying to clear them up.
Each client has their own controller. Read multiplayer compendium pinned in this channel for more info.
Hi guys,
I need a help for multiplayer.
On Joining the session , it loas the level which is open in host,
What is happening, i am just changing the UI on creating the session .So on joining the session , it reloads that map again on success
so is there a way to stop that auto reloading and will it impact the replication of the variables
LogWindows: FPlatformMisc::RequestExit(1, WindowsPlatformCrashContext.EngineUnhandledExceptionFilter) Does anyone know why I get this error on my dedicated server and it kicks out my players?
Hi guys, now I will describe the logic of what I would like to implement on Blueprints, the images will be attached below, but when you click on a given button in my case h, the sequence starts playing from the beginning on the client despite the specified start time relative to the server
The logic of what I want to do:
I need to organize the possibility for me to start a sequence on the server (in my game), for example, 5 minutes pass, and a player connects, he presses a button on the keyboard, after that a request should go to the server (to my game) to get the active time of the sequence (in our case, as mentioned earlier, it is 5 minutes), the sequence starts on the client
p.s sorry for my English😸
It probably crashes, not really much else to go off of
well you'll most likely get a crash dump
and a log file with a stacktrace if the server had debug symbols
yes I am reading it directly from the server log that I have access to
[2024.07.31-10.37.41:090][ 8]LogWindows: Could not start crash report client using ../../../Engine/Binaries/Win64/CrashReportClient-Wi
[2024.07.31-10.37.41:090][ 8]LogMemory: Platform Memory Stats for WindowsServer
[2024.07.31-10.37.41:090][ 8]LogMemory: Process Physical Memory: 232.42 MB used, 248.76 MB peak
[2024.07.31-10.37.41:090][ 8]LogMemory: Process Virtual Memory: 162.27 MB used, 184.95 MB peak
[2024.07.31-10.37.41:090][ 8]LogMemory: Physical Memory: 2318.04 MB used, 1521.57 MB free, 3839.61 MB total
[2024.07.31-10.37.41:090][ 8]LogMemory: Virtual Memory: 2675.11 MB used, 2572.50 MB free, 5247.61 MB total
[2024.07.31-10.37.41:090][ 8]LogWindows: FPlatformMisc::RequestExit(1, WindowsPlatformCrashContext.EngineUnhandledExceptionFilter)
[2024.07.31-10.37.41:090][ 8]LogWindows: FPlatformMisc::RequestExitWithStatus(1, 3, WindowsPlatformCrashContext.EngineUnhandledExcepti
[2024.07.31-10.37.41:090][ 8]LogCore: Engine exit requested (reason: Win RequestExit)
hey everyone. I have a VR session and I want to have the user's movements replicate to the server. Since VR updates the position of the player every tick does that mean I also need to send player transform updates to the server every tick as well?
Use an unreliable rpc. And sure?
Thanks friend. Just didnt feel like the right solution but I guess its fine
it is, but you might want to rate limit it unless absolutely necessary
Sending it every other tick or every few hundred ms maybe? Just smooth it on thr server.
Yeah my concern was about sending too many packets
Unless it's some kind of mobile game, you're probably fine.
What you should do, though, is profile it and find out.
when it comes to hosting dedicated servers using EOS does anyone have any recommendations on online hosting services so i can have a server running bascialy 24/7
Does anyone have a clue why I can't connect to a server in PIE (after 5.4) upgrade. Working fine in builds but tring to connect in PIE, I get this error and the client disconnects:
[2024.07.31-18.43.10:537][409]LogNetTraffic: VeryVerbose: SetChannelActor: ChIndex: 5, Actor: BP_Locke_C /Game/Wildcard/Maps/Arenas/FrostBurn/UEDPIE_1_FrostBurn.FrostBurn:PersistentLevel.BP_Locke_C_0, NetGUID: 22
[2024.07.31-18.43.10:537][409]LogNetTraffic: CreateReplicator - creating new replicator for (0x00000481B6BED800) BP_Locke_C_0 - Replicator (0x00000481BA55FDC0)
[2024.07.31-18.43.10:537][409]LogOutputDevice: Warning:
Script Stack (0 frames) :
[2024.07.31-18.43.10:538][409]LogOutputDevice: Error: Ensure condition failed: false [File:D:\build++UE5\Sync\Engine\Source\Runtime\Core\Private\Serialization\BitReader.cpp] [Line: 276]
FBitReader::SetOverflowed() called! (ReadLen: 100, Remaining: 43, Max: 264)
[2024.07.31-18.43.10:538][409]LogStats: FDebug::EnsureFailed - 0.000 s
[2024.07.31-18.43.28:905][409]LogNet: Error: ReadFieldHeaderAndPayload: Error reading payload. Object: BP_Locke_C /Game/Wildcard/Maps/Arenas/FrostBurn/UEDPIE_1_FrostBurn.FrostBurn:PersistentLevel.BP_Locke_C_0, OutField: bReplicateMovement
[2024.07.31-18.43.28:905][409]LogNetTraffic: CreateReplicator - creating new replicator for (0x00000481B3A52800) CharMoveComp - Replicator (0x00000481BA55FCE0)
[2024.07.31-18.43.28:906][409]LogNetTraffic: CreateReplicator - creating new replicator for (0x00000481B3A51400) CharacterMesh0 - Replicator (0x00000481BA55AC60)
[2024.07.31-18.43.28:906][409]LogNetTraffic: CreateReplicator - creating new replicator for (0x00000481BCD81880) MyForceFeedback - Replicator (0x00000481BA55B6E0)
[2024.07.31-18.43.28:906][409]LogNetTraffic: CreateReplicator - creating new replicator for (0x00000481BCBC9300) MeleeBox - Replicator (0x00000481BA55B980)
Hi guys!
I have a question, what is the best way to handle when a user is disconnected due to a client error or internet failure...
How can I test this? I did a test by calling the Disconnect command but this does not throw any EventNetworkError. When this happens, is the user removed from the Session or Lobby?
its probably because that disconnect is a clean disconect so it doesnt throw any errors, if you wanna know when some one leaves you can override "Logout()" in the game mode i think
he should be removed when he times out i think
I also tried closing the application but it still does not generate any error, although it does disconnect the user from the session. Shouldn't that event be called there?
i dont know unfortunately, i think that UE detects alt+f4 so it might be clean
it might be detecting ur closing
could that be it... thanks again
has anyone added subobjects to multiple components? i want to basically have a "public" list of some subobjects that is replicated to all players
not sure if the idea is sound or if there is some gotcha
is login called before or after InitNewPlayer?
How can i make a template for a predicted variable?
Like the end goal is:
UPROPERTY(Replicated)
int A;
void SetA(int InA);
where SetA will set A predictively in client, then send a server RPC to set A on server as well
Maybe i need to do macro lambda stuff? Auto generate server RPC definition?
This is either a normal idea with common solution or a really bad one
Oh, i see how GAS did it, they just use the same function
No wonder we can't input complex data into abilities
Prediction is simply the Client applying the same operation as the Server, with the expectation that the Server will accept the outcome of that operation.
If the Server rejects it, then the Client miss predicted and should be corrected.
yeah i im just trying not to have a bunch of same function declared
UFUNCTION(Server, Reliable)
void SetA(int InA);
UFUNCTION(Server, Reliable)
void SetB(int InB);
UFUNCTION(Server, Reliable)
void SetC(int InC);
like somehow make a template for all of them
Why do you need so many individual RPCs up to the Server for different integers?
You cant wrap UMacros inside of Macros.
UHT cant see them
I need for my enums
Yeah i wont do macro, ill probably make one function that is able to send each of my enum
What are the enums for that the Client needs to pass them to the Server?
my state enums, for blocking, attacking and animation display stuff
i just need a way to differentiate my enum, like put them in an array or map
UFUNCTION(Server, Reliable)
void SetEnum(int EnumIndex, int Value);
Seems like a very strange approach. If you are using GAS, those things would typically be Gameplay Abilities bound to Inputs, of which the Server will be notified of their Activation and thus run them as well, allowing the Server to understand what State changes need to happen indirectly.
I use both GAS, GameplayTag and those Enum. Any ideas how should i deal with enum index data?
No...
Begin play should be called on Client right ?
on my second PC (the client 1 one), i only have a call on LS
Should be? It always will be.
for OSS you need engine source build and UE_DISABLE_OPTIMIZATION
im not using OSS
What Actor is that?
well is it engine code anyway?
the calls i get on my PC :
- PC_0 : LS
- PC_1 : LS
- PC_0 : Client 1
a beginplay call is somewhat missing
So that BeginPlay node in Blueprint is from a PlayerController?
a child of APlayerController
Did you forget a call to Super::BeginPlay?
i moved to cpp but got the same issue
BeginPlay isnt implemented in my child classes
and if i did forgot the Super call, woulnt that make 0 calls to BeginPlay ?
Typically missing calls into Blueprint like this are due to forgetting a Super
Start with the most common cases.
Thats all.
i am not implementing Beginplay in my BP subclass
What do you mean? You clearly have a node BeginPlay
i got :
- APlayerController
- ACorePC <- beginplay implemented here
- AGamePC
- BP subclass
- AGamePC
- ACorePC <- beginplay implemented here
old screenshot, i deleted afterwards
🤦
should of told it more clear sorry
What is the current code you are having issues with
no calls on client side of my PC_1
resutling in no LocalSS found
this is my curent code
void APGCorePlayerController::BeginPlay()
{
Super::BeginPlay();
AddStartupMappingContexts();
}
#pragma endregion
#pragma region Core
void APGCorePlayerController::AddStartupMappingContexts()
{
if (UEnhancedInputLocalPlayerSubsystem* Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(GetLocalPlayer()))
{
for (auto& IMC : StartupInputMappingContexts)
{
Subsystem->AddMappingContext(IMC, 0);
}
}
}
So breakpointing AddStartupMappingContexts(); in BeginPlay does not get hit?
Is that what you are saying?
yes
i even added a breakpoint in BeginPlay in APlayerController and have the same results
it this could help, the BP code was working fine until i moved my GM stuff into cpp
in this stuff, i changed the ChoosePlayerStart method behavior as well as the choosing of the defaultpawn
InitGameState, PostLogin, ChoosePlayerStart_Implementation, GetDefaultPawnClassForController_Implementation
the first two calls super
Verify you called Super for all those functions
i dont want to act like i know better (because i am not), i just want to understand :
whats the point of calling the super of ChoosePlayerStart_Implementation and GetDefaultPawnClassForController_Implementation since i am myself chosing the playerstart and pawn class ?
There isnt much, just want to make sure you are verifying calls to Super lol
InitGameState and PostLogin are important
Why are you overriding those?
Can you post the code
For them
i am calling super there :)
void APGCoreGameMode::InitGameState()
{
Super::InitGameState();
CoreGameInstance = Cast<UPGCoreGameInstance>(UGameplayStatics::GetGameInstance(GetWorld()));
}
void APGCoreGameMode::PostLogin(APlayerController* NewPlayer)
{
Super::PostLogin(NewPlayer);
if (CanStartGame())
{
StartGame();
}
}
Have you tried closing/recompiling the Editor?
Missing calls to BeginPlay mean you have done something wrong
Its just a matter of finding it
yeah ik im the one with an issue
not causing the engine
i checked for all actors on Client 1 and i didnt saw PC_1
You do realize that there should only be 1 PC on the Client?
Yes
and "PC_1" would "be" PC_0 on the client
Yes
PlayerControllers only exist on the Server and the Local Owning Client
but i still have a null SS :/
🤷
Its a pointer, pointers point to a memory address, so IpConnection must be in the memory address that the Player pointer is pointing to.
okay, im asking because it wasnt named like that for PC_0
Can anyone help me with delay? When I attack while simulating netlag theres a huge delay(noticable at 50 ping) . Is it possilbe to locally predict damage on client?
How hard is it to make a game like Chained Together ?
Hi, Im facing an issue here :
I'm trying to "send a session to another one".
Let me explain : take Dead By Daylight as an example, you can have a friend lobby, private, and when everyone is ready, they are both sent to the true "public" session/server.
So all good, i just need to search for a public session with the server on the friend lobby, repicate it to the clients, and make everyone destroy session and join the new one.
But nope, I tried everything, every way possible, from the gamemode, to the gamestate, it is impossible to replicate the session search ID to the clients, it always returns to null for them.
So is there a way to make that "session switching" possible ?
(BP btw)
Depend on your Skills , even i saw it is a Koop Multiplayer with many Physics Interaction etc. i think it is very Difficult alone , if you have a Team and someone are a Prof. in Dev. Multiplayer Games maybe you get a Chance 2 Years with the Design, Story and Mechanics etc.
story ? The game was made by 1 person tho
Hey, I have this issue where my InteractableActor works on server, but won't ever trigger on Client, and I have no idea what am I doing wrong
I have InteractableActor, and it is called through my InteractionComponent. Everything is replicated, however it seems like whenever the Client gets to the part of the code that is supposed to call ServerInteract, it stops. To provide some context, Player (which is replicated), using InteractionComponent(which is replicated) gets the CurrentInteractableObject, which then I use to trigger the Interact() function. When I trigger this Interact function, it calls ServerInteract after checking if something HasAuthority or not. From what I understand, the HasAuthority() ifcheck automatically should somehow tell the code that if someone doesn't have authority, he should just tell the server to call this function, and if it is the server, this just calls the function. I cant fully understand this concepts.
here, for some context:
Ok for 1 Person he or she did a very good job, it rocks on Steam. ( but in reality no one escape from Hell 😆 )
it doesn't answer my question
It stops because you are telling the Actor to immediately Destroy itself when ServerInteract is processed....
It's just the chain mechanic you need to figure out. Then it's easy. Maybe using physics handle or something like this.
The Chain is only a visual aid.
It wouldnt be driving the limitations.
Nah it seems to be more than visual because if one falls the other pulls them up in the video. It's an actual chain system.
Id argue there would be an underlying system done with something like traces that manages that.
It would be to expensive to replicate the chains themselves
The chain is not just a visual element. It is governed by a physics simulation that allows it to wrap around platforms.```
🤷
Yeah that's what I'm wondering I thought it was just visual too lol
Maybe the chain is not replicated but it's averaging client movements and simulating the chain on clients or something like this would be more logical.
Hope you enjoy it! It's boring to repeat this step. I can generate procedural chains, but I can't generate procedural physical constraints. If you have a solution to this problem, please comment. Thank you!
Project Download : https://www.patreon.com/posts/75203352
Patreon : https://www.patreon.com/A1exHuang
--------------------------------------...
@cobalt notch something like this
Yeah but how to replicate all those characters and chain smoothly is what we're wondering. Must be some trick to this.
I hope we go not out of Topic
It's one of those things you can just build out the chain and characters and then optimise later if it's too heavy, this game doesn't look too smooth so maybe he's just winging it.
wouldn't replicating the position and the rotation of the chains would be enough ?
Maybe you do not need to replicate it at all 'cos they do not know what it's supposed to look like so you can just do what the client does. Maybe someone cheats but then it's not a chain anymore.
Depends if they are also applying server authority to their positions
Yeah like the characters will autocorrect anyways and fix the chain
Could be allowing Clients authority over the simulation.
and you do not need to know if its tight either, two people moving in opposite directions in a tight chain, just allow both, they'll push and pull each other and be back to square 1
Those types of games dont typically care much for cheating
Its not like its a competitive shooter
- they are climbing , jumping Physics the chain must have anytime a connection to each etc. to say easy i think it is not in a MP Game
Yeah but that's all there is, this game doesn't have much else like mp shooting or combat or abilities etc. It's very simple for mp apart from the chain mechanism. Maybe it's all replicated and he's just winging it. Still even in jumping etc. the other clients will do whatever the chain does on the client and this will be pretty similar for everybody without replicating the chain itself.
Okay maybe this is not gonna work, just replicate the chain on all the clients 'cos this game doesn't really have much else. Otherwise partly client driven to make this faster because cheating is not an issue.
The server does all the movement and handles the chain and the clients just see the replicated results of this.
Interesting we learning here very good stuff @cobalt notch
The endpoints of the chain are the characters themselves so I mean this replication can be avoided but one would have to plan this sort of thing properly. Whereever character is the chain endpoint is the there, the rest of hte chain doesn't really matter, and physics should be handled automatically whether the chain is replicated or not it's still tied to them.
the rest of the chain does matter because it can collid with objects and stuff creating some mechanics
Check out Chained Together, @AnegarG's upcoming Unreal Engine-powered co-op platformer that tethers players with one another and tasks them to escape hell.
Details: https://t.co/1hgs4jJjks
#unrealengine #unrealengine4 #unrealengine5 #ue4 #ue5 #gamedev #indiedev #gamedevelopment
Look at this mechanic
That does not have to be replicated unless you need visual parity in all clients. It will be roughly similar if the endpoints are the same on all clients due to character positions being replicated. The server will push things that are in the way of the chain because those are replicated.
yeah
Just my Question, I have a Level when i want spawn my Character Class my Gamemod have this Class , it just working correct when this class is already in the Level , then it spawns 1 on the Server and 1 on the Client side Automatically. Then i destroy the one in the level via Level BP. Do you think it is Correct (Listener Server) @cobalt notch
The spawning and destroying should happen on the server only. This will spawn and destroy on the clients if the actor is replicated. Same in level bp must be done on the server. The Initial creation before beginplay does not matter in this that happens for everybody if you're placing things in a map.
But i use just 1 Class does it matter
Yeah what you described is okay but in the level bp you have to destry this on the server putting "if has authority".
Ok thanks , Men really the problem is everytime MP Games will not so complicated if you can have 2 Classes one is the Server one is the CLient , what you think about , sorry is a silly Question
Listen server is more complicated because you have to be both client and server which is mind boggling. Normal Multiplayer is a bit easier if you just do dedicated server but extra costs / setup etc.
This brings me more light inside MP Games , thanks
I hope I am not asking something stupid, so how do most people handle things like continuous inputs( ie. like looking around, car throttle) when axis value that just keep updating every frame.
What do you mean?
Can you elaborate or restate your question in a different way?
so currently, I do this. InputAxis-> RPC run on server -> RPC update the server pawn.
but I kinda feel this is sort of not the right way to do it. shouldn't there be a more straight forward way like
Input Axis-> update some variable that only I should be changing-> server somehow get my updated variable, run the logic then replicate the to the rest of clients.
There isnt anything inherently wrong with sending an RPC every frame
Especially if its input axis related
as replication only go from server to client, what's the basics for sending updates to server, without stacking so many rpc calls. (as we can have so many buttons and controls, on/off or axis doesn't matter. )