#multiplayer
1 messages ยท Page 560 of 1
yeah, 100 animated characters (pubg/fortnite) require a LOT of engine work
thats not something you can get working well easily
I'd be very happy with 50-75
It seems odd that at 50 characters, everything just stops working totally
anything past 30-40 starts getting hairy
just use actors
those dinosaurs arent too complex to require a character movement component
The AI characters don't start moving around, my player controller doesn't get proper control of my own characters. Super odd.
you might be super-lagging on the server
moving 50 replicated and animated cmcs around is no joke, on my tests with shootergame characters something like that will use 20+ miliseconds
those dinosaurs arent too complex to require a character movement component
Could you provide some insight into when you would add a char movement component?
when its an actual player
thats what the cmc is designed for
using it for npcs is super overkill
the cmc does a lot of fancy prediction logic, network smoothing, and network rollback on mistakes and similar
you just do not need that on npcs
no
(As players and AI can both control the same kinds of characters, would like to keep it uniform)
you could indeed swap them out
Remove the CMC, or add it back on when needed
No no, the CMC
controlled dinosaur being a different thing than a wandering dinosaur
Hmm
i dont think you can remove the cmc from a character class
I could swear I saw someone write about doing that
But I could be very wrong
I'll test it out
At least this helps me understand the whole situation a bit better
Appreciate the insight ๐
there was some absolutely crazy shit i was experimenting with
to try to achieve 200-300 players
the idea was that you dont replicate the character
you copy its parameters into a fake-character
which is just a very simple actor
so each player controls a full cmc-character, which is replicated, but only to the server, not to other players
the server then copies its position/rotation into another actor, which is what other clients see
because that proxy actor is so simple, its super fast, and lets you have a fuckton of them
tho the server absolutely does chug with having to calculate so many cmcs, but there is trickery you can do to improve it, like disabling collisions and trusting the client
Paragon didn't use CMC for it's minions for example
Seems like I'll have to have 2 different base classes
They just have some low-cost actor that tracks along the navmesh IIRC
yeh, i can confirm that works
i wrote a custom cmc for my vr game that did no collisions
just slides on the navmesh
navmesh raycast is very cheap
on my testing you can do about a thousand of them per milisecond
Can't I disable the CMC at will instead?
so yeah... fast
@potent cradle yes, you can disable ticking on it or similar
but stil...
Still bad?
still paying some of it's overhead even when it's disabled
AI just talks to interfaces right? Shouldn't be dependent on something being a character
ai talks into character
Being a pawn ofc, but not character specifically
its kinda fucked
on a newer project i had i basically just fully ignored the AI system
and just made my own
I though it only dealt directly with lower-level stuff like UNavMovement etc.
you can run behavior trees standalone
Yeah I'm not a fan of the engines AI system..
they can basically just run by themselves
so you can do it yourself
one thing i had is that i just ran behavior tree on top of the simple Enemy actor
and said Enemy actor had a bunch of components for different stuff such as melee combat logic
i do something kinda like that but worse on my Hovergame project
in here i just have a Enemy interface, and i have multiple versions of it
some enemies inherit from Actor, others from Character. But none of them actually have AI controllers, they just run the Ai logic on their actor itself
ai talks into character
AI as in what part specifically?
But none of them actually have AI controllers, they just run the Ai logic on their actor itself
I can't even use AI controllers?
Dear lord
Ai controllers suck hard
they force you into the character class
which is something you absolutely do not want
they are designed for player bots
where you have some multiplayer bots and the likes that simulate a player
for actual npcs its not a good idea to use it
I wish I knew that earlier
But grateful for the info
Looks like I'll have to reduce the scale for now and gradually polish up the codebase to the point where the logic is cleanly enough separated that I can switch over to lighter solutions with less issues.
I've found AI controllers themselves aren't neccesarily tied to the character class
Just the default behaviours that come with the engine for behaviour trees are
But tbh, for simple NPC's - do you even want/need that overhead of the full AI system etc.
the behavior tree is pretty damn useful
you can repurpose it for a lot of things
tho it does create a ridiculous shitload of uobjects
plus a lot of slow ticking
you will know when you actually need it. A lot of very crappy enemy types work well with a very simple state machine
Is a real dedicated server better at handling all this than the PIE dedicated server?
How well does the performance match up when compared between the two?
I'd imagine so, considering the machine is doing less things at the same time without overhead, but on the other, locally bandwidth shouldn't be an issue which is a plus for performance while testing.
dedi server in PIE is 95% the same thing
But yeah, information is transmitted instantly and with no real cap on bandwidth. You can simulate packet loss/latency with some in-engine settings (I just run Clumsy)
yeah, I just use that instead of the in-engine settings. It works the same, I just find clumsy more convenient
@chrome bay Do you use a particular filter/config that I can note down?
For clumsy
You just nuke your whole connection instead of specifically Unreal?
I saw it had a filter option, but maybe it doesn't matter then
yeah, just remember to turn it off when you open up YouTube ๐
Hi, is is possible/common to create widgets (hud) inside the player state?
No
Well it's probably possible but it doesn't make sense
Player state is replicated
https://www.youtube.com/watch?v=oDSJ7vixpCE at 1:14:12 @thin stratus goes over getting the steam game name using the GetAppName(). I tried doing this on my own app ID but the Steam Game name is invalid, i.e. - NameLength returns -1 - does this only work if your product is verified or something?
Getting your game working with Steam is frequently an important part of one's development cycle. Cedric will begin with a walkthrough on how to integrate the Steam SDK, and once that's ready to go, he'll dive into exposing your friends list to UMG.
Uh man, 3 years old already. Time sure flies
Honestly, I'm not sure why it would return -1 for the name length. Did you see anything in the steam docs?
yea I know ๐ - the only thing I could find about getting the steam name though
Yes - it says this above the function definitions
//-----------------------------------------------------------------------------
// Purpose: This is a restricted interface that can only be used by previously approved apps,
// contact your Steam Account Manager if you believe you need access to this API.
// This interface lets you detect installed apps for the local Steam client, useful for debugging tools
// to offer lists of apps to debug via Steam.
//-----------------------------------------------------------------------------
class ISteamAppList
{
public:
virtual uint32 GetNumInstalledApps() = 0;
virtual uint32 GetInstalledApps( AppId_t *pvecAppID, uint32 unMaxAppIDs ) = 0;
virtual int GetAppName( AppId_t nAppID, STEAM_OUT_STRING() char *pchName, int cchNameMax ) = 0; // returns -1 if no name was found
virtual int GetAppInstallDir( AppId_t nAppID, char *pchDirectory, int cchNameMax ) = 0; // returns -1 if no dir was found
virtual int GetAppBuildId( AppId_t nAppID ) = 0; // return the buildid of this app, may change at any time based on backend updates to the game
};
Yeah I guess you have to do exactly that then
Iirc I was using the 480 app id in that video
Which probably has access to it
ah dang that's kind of annoying, but yea time to ask my product manager then lol
I feel like it should be part of the friends API...
Yeah, but you are after all requesting the names of other games here too
So I guess that is indeed more of an App API
my pawn always spawning in Zero coordinates, why?
If I drag my pawn into the editor, it's properties replicate, but if it is possessed by a controller, they do not replicate. What can be causing this?
what makes you think they replicate when dragged into the editor?
It's a ship that follows the motion of the ocean. The buoyancy is handled server-side, and the movement is replicated to the client.
So, it seems it's only being replicated for Simulated actors.
@bitter oriole thx yeah though so to, just wanted to be sure ๐
so clients see other clients fine?
so none of them are relevant to any connection?
well, either your relevancy is very broken
or your loaded from package boats can handle buoyancy locally and don't replicate at all
Good afternoon. I need to ask a couple questions about mixing local and online multiplayer from those who have accomplished this before. My game has only up to four players total. Any advice would be appreciated.
Firstly, if a gamepad must send input via a player controller actor even to spawn, does this mean I must spawn extra player controllers just in case they'll be used?
Cheers.
@winged badger, I'm not sure what you mean by that second part.
well you do have at least one bug
it is conceivable that your boats know how to bounce on waves without server, as far as i know, at least
Yes, I currently have it calculated on server because the other movements are more subtle and will take longer to debug the replication. I will be moving the undulation client-side once I've figured out what is wrong because any lag at all will look odd.
But It is only being calculated on the server.
Thanks @winged badger, I figured it out. I had some weird ifs that were catching the server rather than the clients, and I have no idea why dragging the pawn into place still worked, but I fixed it.
Hi all. Quick question if anybody encountered this already. When I'm trying to start the game with two players it crashes the editor (when two pawns get spawned) with PlayerInput::ProcessInputStack()
I tried with one game pad and without, from the editor and started from the command line too
Is there a reason a client calling GetMesh()->Deactivate(); wouldn't actually do anything and the mesh + anims keep playing, even though the same code freezes the mesh + anims on the server?
Running into performance problems because even though the server and client call the same code, the mesh is never deactivated on clients while it is on the server
Even spamming multicast RPCs to test with that code above doesn't deactivate the mesh on clients.... works fine when the server calls it
To clarify this is an ACharacter so the mesh is a USkeletalMeshComponent
you went and read the Deactivate function?
@winged badger
if (ShouldActivate()==false)
{
SetComponentTickEnabled(false);
SetActiveFlag(false);
OnComponentDeactivated.Broadcast(this);
}
ah ok thanks testing that now at a fixed rate (didn't work on a one of on rep call)
we had problems at one point with 2x animation speed on clients
Still doesn't work ๐ฆ
because CMC was ticking the skeleton
yeah, we assign our roles by hand
and they were off at the time for autonomous
and CMC is hardcoded steaming pile...
I'm calling this multiple times a second via multicast RPC to test
SetActorTickEnabled(false);
GetMesh()->Deactivate();
GetCharacterMovement()->Deactivate()
yet the enemy meshes are animating and notifies are firing etc....
Only on the client
Kind of eliminates the point of my pooling system
TickBones boolean?
Trying these
GetMesh()->SetComponentTickEnabled(false);
GetMesh()->VisibilityBasedAnimTickOption = EVisibilityBasedAnimTickOption::OnlyTickPoseWhenRendered;
Woo ok it looks like GetMesh()->SetComponentTickEnabled(false); works
Still very strange that ->Deactivate() only worked on the server for no apparent reason, makes me wonder what else may be only being called there, potentially reducing performance on clients
almost zero different
you have more players to juggle
for detection, decisions...
other then that, no difference
AIPawns do need to properly replicate though, but that doesn't fall under setting up AI as much as setting up Pawn
and is no different then replicating a player pawn
@meager spade What is strange though is that GetMesh()->Deactivate(); appears to do that already on the server (or at least SetTickEnabled(false); one of those)
It's odd that SetComponentTickEnabled has to be manually called on the client
Right but calling those same two lines on the client doesn't stop the ticking
Only SetComponentTickEnabled does that
maybe its gated?
Even though it's not needed on the server
YEah maybe
Anyway good to know it must be called manually, thanks
maybe clients just don't set the Active flag
if (ShouldActivate()==false)
is the gate here
so maybe this returns true on client
But IsActive surely would be true on the client if the bones are moving etc.
Seems strange either way
But yeah you are right they might just not set IsActive at all
So ShouldActive never returns false
When I start my game with more than one player, the editor viewport seems to act as a client instead of the host
like this code should spawn two managers, but you can see they dont show up in the editor (they spawn in single player)
(WorldGeneration and EnemyManager are missing)
These are my multiplayer settings. I'm wondering if this is intended or if I'm setting something up wrong
@twin sable you can set the observed world under the outliner
@lost inlet Thank you so much, never knew you could do this
@grizzled stirrup its replicated BUT it doesn't have a OnRep
so it doesn't actually hide on the clients
Weird, it did seem to be hiding correctly on clients from a server only call
maybe its done elsewhere
Do you think it's because I am doing it directly after spawning on server
No delay
So it replicates down initially as hidden?
And that is called only on the initial replication?
no
virtual void PostNetReceive() override;```
PostNetInit is initial
virtual void PostNetInit();```
Oh so in effect it would consistently hide on the client then?
yh
That's pretty sweet thanks
Is if (GetLocalRole() != ROLE_Authority) the same as if (GetLocalRole() < ROLE_Authority) ?
Since AFAIK nothing else is equal or greater to ROLE_Authority
yes
is their a way i can simulate packet loss and lag
is their a way i can simulate packet loss and lag
@slim matrix
There's also in-engine console commands, but this was recommended to me here in chat today
so
I've noticed that no matter how much I try to optimize my networking, the result is ALWAYS shitty as soon as I have around 5 or 10 of whatever actors I'm working on
I'm testing this in the editor using network emulation (on both client and server) at 'Average' case
And this is really confusing because when I look at other games, they can run 30+ actors together with seemingly no bugs, and near perfect synchronization at super low latencies
is the in-editor network emulation somehow worse than real servers as far as networking is concerned?
What am I missing?
I've tested different net priority values, I tried on-tick RPCs, I tried normal property replication, I tried lowering rates, increasing rates, I tried compressing values during serialization as much as the engine allows
is it wrong to spawn an actor on the player state? im spawning an possessing but the pawn is floating mid air without falling to the ground and it doesn't even receive input
@unkempt tiger The answer is probably that other games have has a lot of work on them by dozens of network experts. Networking is really hard. Explain your issues and you can get help
Yes, it is hard! However I know the theory and have some experience myself, and I did the math, I could barely squeeze enough bits per second as other games must have. Even if those other games used deterministic locking and somehow only sent super-compressed input-only packets it still didn't add up
I did notice that running my tests with a UE4 instance per client (rather than running all clients under the same instance) resulted in much better results, and it finally matched my expectations
But that does make me wonder, is there anything else of similar nature I can do during my tests to better simulate the real world case from within my editor?
The editor isn't really the place to test networking in general, it doesn't support sessions, and it's quite different from regular gampelay
its not a place to do stress tests in, but "casual" gameplay shouldn't have much problems
I made simple host server, browse servers and join them with Advanced Session Plugin. It works through LAN, and on my local pc it works fine, but when i try to use it through Hamachi, to emulate LAN with other ppl, game doesn't see any hosted servers.
how to replacated montage with rootmotion ?
Hi, for my game i have a background map in the lobby. Any idea about how to make that map static (so it wont be replicated)?
i know, my question a bit weird, but was hoping i missed maybe some smart way to make it like i need ๐
seems ill have to code it for like everything
I don't understand what you are asking
basically in the lobby i use the same map and savegame for the citybuilder style game
however as its just a visual thing, not playable i dont wanna replicate the game in the lobby
ingame it does need to be replicated, but its the same map to
Well, don't spawn replicated actors before the game starts
Though honestly, I don't see big issues with having the networking while in the lobby
yeah, i thought about it to., if it wont hurt it might be okay
Is it documented anywhere exactly what happens with server rpcs called on the server?
Say I have a client rpc Foo that calls a server RPC Bar, and the client is the server (listen server):
ClientFoo_Implementation() { ServerBar(); }
Which happens?
- ServerBar_Validate and _Implementation get called immediately
- ServerBar_Validate and _Implementation are queued, and then called immediately after ClientFoo_Implementation returns prior to any other RPC being handled
- ServerBar_Validate and _Implementation are queued behind every other RPC and then called only after other RPCs are processed, but on same net driver tick and before the rest of game is ticked
- ServerBar_Validate and _Implementation is queued and then called only after net driver is ticked again on next engine tick
RPCs that don't need to be routed are executed as a normal function
so a client RPC on a server, which does a Server RPC, will just be normal function calls and skip the RPC stuff.
hmm that's the assumption I had been making, just wasn't seeing it happen when I added a breakpoint
I'll have to see what's going on
i mean that is what i am lead to believe, they just execute like regular functions if RPC is not needed
ahh, I had play as client turned on, so it was running as if dedicated server
ok yeah I'm seeing it called immediately when I put it back to listen server mode.. whew
that was going to break a lot of assumptions
Hello everyone :)
If I have a consumable which gets placed in the map, not spawned. And I want it to get destroyed for all players when one of them overlaps (consumes) it. Does it have to be set to replicate? And treat it that way?
Or is there a way to destroy the actor in a different way
@gusty slate You could technically delete it with an RPC, but it is advisable that you replicate the actor itself, and delete when needed. If you dont have any other variables you need replicated, you can tune down the NetUpdateFrequency.
Hmm, setting them to replicate and calling a server RPC gives me the error that no there is no owning connection for the volume ๐ค
you cannot issue commands to the server from anythinmg other than player controller, or a player controller posessed pawn
or anything owned by either of those
yeah, the owner chain must be owned by a playercontroller.
you probably should handle the overlap, and pickup event on the server, and do a multicast RPC to clients when someone picked up
Hello
I have a problem, when I try to replicate a socket (With IK/Aim offset) when I set Owner no see the socket doesnt get replicated to owner and stays floating, the major problem is that I cant query the location of the socket
Please can someone help me
When I try get the value it stays static to the owner who cant see their animation anymore
Good morning. I'm looking for a way to detect gamepads connecting and disconnecting in Blueprint. Any advice would be appreciated.
Cheers.
handline any key pressed and checking if its a gamepad key, possibly
I see. It seems to me that I have to spawn extra player controllers just in case there's a gamepad connected.
if you connect one with the editor running I think I remember it prints a debug message in the output log? maybe search engine source for that message, maybe you will find an event if your google-fu (or discord search-fu) isn't finding any results
any reason why my FFastArraySerializer wouldnt have its NetDeltaSerialize called on it? despite replicating nicely
Thanks, HoJo, I'll look into that.
how do I know character fell from a specified height ? I want to apply damage based on that ๐ค
use the velocity for fall dmg
@rose egret map fall z velocity to dmg
is there a way to make an actor replicate only to its net owner?
I suppose I can override IsNetRelevant with a net owner check?
But I'm hoping there's a better way :)
Relevant Owner only?
Yes
UPROPERTY(Category=Replication, EditDefaultsOnly, BlueprintReadOnly)
uint8 bOnlyRelevantToOwner:1;```
๐คทL
When using line trace weapons, what is the most optimized way to display bullet tracer effects? Basically faking it to make it look like a bullet flying through the air, even though it doesn't really do anything. Should I spawn a projectile that does nothing but get destroyed when it collides? If so should I spawn it on server and make it replicate movement? I'm just trying to figure out what is the best for bandwidth.
@cedar finch just send a start position, and a direction vector, then on the client use those to display an instantaneous trace effect (you can also add hit position / bullet type / whatever else you might need)
that is if the bullet is fast
if its a slow projectile that has a lasting presence in the game you should use a different solution
The weapons are hit scan weapons that are using linetraces so they instantly damage whatever you're aiming at. Such as full auto M-16's etc. I was just trying to make a fake "tracer" that would visually look like a bullet but not really do anything. That way it looks cool. So I have the start location, direction, and hit location before I even spawn a projectile. The projectile is just for looks. I just was wondering what the most optimized way to spawn it and make it move was without hurting performance
what do yo mean by effect trigger?
whatever code spawns the effect
Ahh I see. Sorry about that. That makes sense. I could just spawn the projectile in the same event I spawn the muzzle flash.
Thanks. ๐
dont spawn them too often tho
a lot of games do like a smoke trail, but spawn a tracer every 2-3 shots
on fast firing guns
That makes sense. Is there no other way to fake it that wouldn't impact performance? I only ask because people always tell me "hit scan weapons don't look as cool a projectile weapons" so I was trying to fake a way to make them look cool.
most fast firing guns in games are hitscan, for example in games like Fortnite, and Call of Duty
projectiles guns are like rocket launchers, they just spawn tracer effects
to make it look like you are firing a bullet
now to make them not cost a lot
you pool them. In my game i have a ClientOnlyFXActor
this holds pooled weapon FX, impact effects, etc
then its simply a matter of moving them to where i want, activating them and voila
Player fires weapon, gameplay cue for shot is generated, sent to all clients, clients grab there local fx actor, and set the fx to the supplied cue information (which holds the HitInfo)
thing is, you still have to tell clients every shot happened, i generate around 7-8 gameplay cues for a single shot, and they are each a multicast, but i actually do something clever, i intercept them, and send them as an optimized single cue ๐
(getting off topic a bit), but just explaining my weapon system
I believe you were the person who told me to do that with my weapon system. I combined my bullet hit info into one struct and it boosted my performance a ton. It saved me from doing a lot of multicasts by putting it all in one. I know yours is more complex than mine lol but I remember you helping me. ๐ But to get back on topic lol, you said you can spawn tracer effects, Those are just particle effects I assume. I could just spawn them at the same time I spawn the muzzle flash couldn't I and it would look like bullets but really it's just an effect
yeah just particle effects
well muzzle flash doesn't know the direction
so it would have to be done once you have the actual shot info
Yea I just realized that lol It's playing in the wrong direction
Aye anyone have a good tut on multiplayer through epic , not steam?
I haven't seen any yet. I figured it was still new and people were still learning it all.
Hmmm So I can't for the life of me make this trail effect rotate towards where I'm shooting. It looks like it's always headed towards (0, 0, 0) I have the start location and hit location but it won't rotate. https://i.gyazo.com/7d02b99884bd274d3e64064a407079a1.gif
@cedar finch where did you get that trail from
you need to set the end point
which for that particle is "beamend" IIRC
it doesn't use rotation. it uses a particle vector paramater.
it might be "shockbeamend" for that matter, i forget.
opening one of my test projects to check.
shockbeamend
@cedar finch you need to set the end point
if (Particle)
{
auto Scale = FMath::RandRange(Hitscan_TrailScale.X, Hitscan_TrailScale.Y);
Particle->SetWorldScale3D(FVector(Scale, Scale, Scale));
Particle->SetVectorParameter(Hitscan_TrailTargetParam, EndPoint);
}```
^
i really need to finish my plugin and release it.
would be so useful for so many people.
(i separated the vehicle stuff into a sub-plugin though)
i also have some engine changes i need to attempt to make a PR for, that implements al lthe missing physx stuff, that engines like Unity have.
(begin/end collision(touch), etc)
and actual friction events
so you can do like scraping. like when a sword slides along a surface, it scratches with proper friction.
zz nite.
Thank you guys! Works perfect now! ๐
not sure if this is the correct channel, but I'm trying to make an achievement in steam based on lifetime account # of kills - has anybody done this with blueprints?
I built something similar to your inventory system @gleaming niche
i'm a bit swamped with client work, but eventually I'm going to put it on the marketpalce
maybe we can share notes
also, i do not recommend expanding the physx vehicle system, chaos vehicles are in 4.26
at this point it's probably best to just wait
because the underlying chaos vehicle sim is extendable
excited for 4.26 chaos updates ๐
are the chaos vehicles supposed to replicate and have network interp?
i know chaos has some replication goals for it in the roadmap
also the roadmap is confusing. it sounds like chaos will be done in 4.26 but ive also heard its one of the things theyre going to release in ue5
its unlikely chaos will be done for another year at least
Anyone have the a link to a video or a breakdown explaining the multiplayer changes that came with 4.25? I had it working between 2 different IP addresses and now it's broken. Can't get the setting right. Used to only use dedicated server checkbox, but that is gone now.
Local split screen works. Client one hosts, client 2 sees the game and can join it. just don't know what I need so me and a friend can play the same game together. What settings do I need for him to see my hosted game?
When an object has a replicated array of structs, does the entire array replicate each time a value of one of its elements is updated or is just the updated element(s) replicated?
Only updated elements
oh thats awesome. thank you ๐
ah that's even better if so
On a listen server, anyone know why in GameMode::PostLogin() my PlayerController->GetPawn() is null for the host but not for the client?
on any server, unless you delay beginplay or custom spawn the controller deferred
well, for PostLogin even that doesn't matter
you can't have a Pawn at PostLogin, unless you overrode half the GameMode
client or server
after PostLogin, few native functions are called, then HandleStartingNewPlayer, which spawns default pawns by default
PostLogin also doesn't happen on clients, its a function on GameMode
I know PostLogin doesn't happen on clients, but when a client logs in GetPawn works inside PostLogin, but when it's the host logging in GetPawn() is null
on servers, PCs get instantiated, then call BeginPlay, then Posses a Pawn, so they don't have a Pawn on BeginPlay
on clients, the replicated Pawn reference gets set and OnRep called before BeginPlay, so they do
ok, so I guess PostLogin isn't the best place for what I'm trying to do. I'll try moving my logic somewhere else, thanks
HandleStartingNewPlayer is where GM by default calls RestartPlayer, which spawns the DefaultPawn
its also the best place to override any logic that has to do with start of the game and Pawns
if you don't call Parent/Super then you have to spawn the PlayerPawn manually
oh nice, thanks for the suggestion, I'll look into it
its also called from both PostLotin and HandleSeamlessTravelPlayer
so it works in both scenarios
if the pawn is controlled by a player, then the owner will be the player. And if the pawn is not controlled by the player, will the owner be the server?
the owner will be null, unless its explicitly set
@winged badger why then for an uncontrolled pawn the function "IsLocallyControlled" returns the true?
on server side
It doesn't unless it has a controller
It probably has an AI controller if it's true and a player isn't controlling it.
bool USolsticeObjectLibrary::IsLocallyControlled(AActor* ActorToQuery)
{
if (!ActorToQuery)
{
return false;
}
AActor* TopOwner;
for (TopOwner = ActorToQuery; TopOwner->GetOwner(); TopOwner = TopOwner->GetOwner())
{
}
APlayerController* Controller = Cast<APlayerController>(TopOwner);
return Controller && Controller->IsLocalPlayerController();
}
my answer to IsLocallyControlled question
static function, can just shove any Actor, or GetOwner() of any ActorComponent into it
Anyone have the a link to a video or a breakdown explaining the multiplayer changes that came with 4.25? I had it working between 2 different IP addresses and now it's broken. Can't get the setting right. Used to only use dedicated server checkbox, but that is gone now.
@queen flower i had to revert one of the changes for me with my engine build, because it would never pass the URL options in editor.
well, without actually running standalone or whatever, i forget now. it caused great agony.
anotehr stupid change.
that was clearly not tested properly.
@shut loom yes
@wicked brook Was a fleet just the servers with a specific build?
Iirc a DedicatedServer on GameLift gets an Init Call or so, in which it can prepare before allowing users to play.
If that Call contains info about the GameMode, you could start the map with the given GameMode (dynamically) and thus stick with one "fleet".
But it's been a while since I used GameLift.
I know that I couldn't do that with PlayFab, because PlayFab had no info when it got the allocate call, something like that at least.
well you really only need separate fleets if the game modes are for different maps.
if the map is the same then one fleet should be fine
in mine we have different maps so we had to use a fleet for each map
I have not tried it like that though
But why
Like, you can always do open <MapName>?game=<gamemode>
As long as your map supports the GameMode, that should work just fine.
any ideas on how to make nameable multiplayer servers? I have code to make a server but want people to be able to name it, similar to how wolfquest is as well as password protect it ๐ ๐ After having named it I want to make a list of servers so people can join them if they know the password ๐ฌ
Am I correct in thinking that variables controlling animation / movement should be replicated inside the character blueprint, but NOT inside the animation blueprint? I've got movement speed changes happening over the network, but for whatever reason those same variables driving the animation don't seem to work ๐ฆ
Except for Jump, that works fine, but the client has a lot of jitter when jumping (when viewed from the server's perspective)
@regal storm Animation should not be replicated. Animation should have absolutely NOTHING to do with the server. Each machine should handle any animation for the actors on it, even if they are replicated to the machine. The animation blueprint should be able to get variables without any network use. Your actors themselves should be doing the network stuff and the Animblueprint should just be getting variables and setting animations based on those variables.
In theory, this ends up with all players seeing exactly the same thing, since all clients get all the variables the same way which leads to the animblueprint doing nearly the exact same thing.
Thank you! Yeah so right now the client can see the server perform everything, and everyone can see themselves perform everything, but clients can't see other clients animations. Must be missing something somewhere (note to self: Replicate from day 1, not after a system is built)
All of the variables used to trigger/impact animations are replicated in the Character BP, and the Anim BP pulls those and sets them locally to a separate duplicate set of variables for easier access throughout the Anim BP.
I guess I need to filter through everything I've done and check if there is one variable holding this all up
Typically most of this should be state based replication as far as I understand. So your clients should be Server RPCing to your server, setting that variable on the server version of that actor, and then that server version would replicated it back to everyone.
Crouch for example. One single RPC with a boolean input. Button pressed send rpc with true, button released, send RPC with false. Server gets RPC, sets that variable locally(on the server). Server replication happens, sends that variable back to all clients. Anim blueprint pulls the variable from the character and changes it's state based on that.
From my understanding the Crouch / Uncrouch approach is already replicated in CharacterMovement?
Can be. It's just an example.
Ahh, okay ๐
I can't see anything totally wrong here, but perhaps there is
(Ignore the Branch issue in Crouch/Uncrouch)
The movement controls are a bit confusing. How come the server and clients aren't being called the same way?
Ahh, hmm - I'm not sure what you mean? The client runs the event on the server when setting the variables, is that not correct?
Pretty much all of that should just be the local machine calling Add Movement Input. It's replicated automatically in character. So All clients will see all clients move.
Ahh, yeah so the client does call the Add Movement Input, but the InputX/InputZ and Direction are being used in the Animation Blueprint, so my thought was they needed to be set by the server?
I guess the server runs it as well with my current setup, but I could change that so only the client runs Add Movement Input
You can get that kind of stuff in other ways besides extra rpcs. For example, most movement can be based on control rotation, or character facing mixed with character velocity.
Ahh, so I should get that information in the Animation BP through other ways? Instead of keeping the replicated variable?
Would that not arrive at the same result either way?
Ahh, hmm a quick test just getting velocity did fix the issue. Means I'll have to rethink how I calculate a few things but that helps. Thank you!
It would, just that pretty much all information that you need for that stuff is already replicated and available.
Using steams 480 app Id, how many players can you connect? I've been seeing 4, but we cant get past 2 for whatever reason
Anyone know what play or multiplayer settings I need to have so a client can see my hosted game? LAN works, but non-LAN clients fail to see my hosted game.
I've tried variations of Open Level with Listen option, and Run as Client, and Run as Listen Server. No luck.
Which online subsystem are you using ?
Not sure what a subsystem is, but I've enabled advanced sessions plugin. I have the steam plug in but its disabled
@queen flower You need a real (like, Steam) OSS to have online matchmaking.
Platforms don't perform the service for free
Steam and EGS are the only two doing it for "free" on PC AFAIK
Though EGS doesn't have a nice official plugin yet
GOG does, but you need your game on GOG first
ok @bitter oriole so i should enable steam and try again? with what settings on the hosts end? what settings on the clients end?
and just for clarity, is standalone required for this to work?
I got the defaultengine.ini text added, and the steam popup in the bottom right is not appearing in standalone
ive enabled the plugin
I am logged into steam
I have restarted the project.
I followed this guys video:
https://youtu.be/XlqHG1egnn0
UE4 / Unreal Engine 4 Multiplayer Playlist:
In this collection of videos, we will cover setting up a project for both local and networked multiplayer projects.
This Video:
In this video, we get the project ready for all of our networked gameplay by adding the Steam Subsystem ...
Basically tells me where to put the steam default engine text and where to get the advanced sessions plugin
The video shows it working
So I understand SteamNetDriver blocks direct IP connections. Is there a way to allow it to do both direct IP and Steam ID connections?
Use case is, we have dedicated servers that will start up from our fleet, we don't need to register them to a master server, because clients will be told which server to connect to. We could use IPNetDriver and that fixes that problem. But we also use Listen servers, having the NAT traversal built in with the SteamNetDriver makes things really nice for people wanting to host Listen servers.
Hello guys
Pls how do I go about fixing jittering of client
On the clients screen, the player jitters but on the server it does not
make sure Skeletal mesh is not set to replicated @frozen brook, ensure max walk speed is the same on client and server
I got through following this on youtube {Blueprint Multiplayer: | v4.11 Tutorial Series | Unreal Engine} but have two problems 1: able to join more them max players if joining several at close timing. 2: My Game settings no longer functions when it use to. Any ideas on ether problem?
Solved problem # 2 my player save was Not getting set.
@frozen brook If you mean the client's own player character jitters on their own screen, but their character doesn't jitter on the server's screen, it's usually an issue with the client trying to move their character too much. In short, the client thinks it's slower or faster than the server thinks it is, or the client is making extra move calls on it's own character and the server is resetting it.
Does anyone know if theres some callback telling the server that the current actor just got replicated to the client?
hey guys i have some questions.whats stuff should be add in the replication graph?what stuff that required to add?any examples?
ShooterGame has a full example of using rep graph
yeah i read the code of shootergame and i thought only the players and the projectiles they added..my quetsion like what's the general thing that should be add into the graph?i know this is different between games but im really clueless
what do you ususally add in repgraph for your game jambax?
๐ค
tbh it's a pretty long topic, I followed a similar pattern to shootergame. It's not too difficult to make sense of once you've followed it through.
sorry if this a noob question im new to repgraph coding
any like example you can give
๐
Can't get more of an example than a working version ๐
hmmm can i know like my project is an rpg maybe examples you can think of on that ?
๐ค
like what i can think of is things liek the players,world chest(like the one in fortnite),arrows projectile
pretty much actor that need to be network optimize
Well ShooterGame has all those things near enough, you just need to decide how each class should replicate and who too
Generally speaking InitGlobalActorClassSettings() is where you sort classes into a special TMap, that map links classes to an enum which determines it's "replication policy"
๐ค
Then you override RouteAddNetworkActorToNodes(), figure out what replication policy the actor uses (based on it's class), and add it to the appropriate node(s)
is InitGlobalActorClassSettings() in the original repgraph.h file?
wanna see that code comment
i think i didnt use that fucntion
virtual void InitGlobalActorClassSettings();```
How you setup that data is up to you though, the base rep graph is pretty barebones by design
ouh...okay yeah i definitely need to override that
๐
that fucntion is getting called before the actor get route to this right RouteAddNetworkActorToNodes(),
It get's called once when the rep graph is initialized
@meager spade it's working now...thanks man
ahhh okay
what was the issue @frozen brook ?
imma redo the code a bit..thanks and imma re read the shootergame repgraph again
Jittering of client
yes but what fixed it?
Yeah, go through it step-by-step. It's actually pretty simple once you get the idea
You lose per-actor relevancy etc. settings but it's worth it if you have huge actor counts or lots of connections
You said I should not replicate the mesh @meager spade
If you only have like a few players and a "normal" amount of actors, it's probably not worth it.
yeah people click Replicate on the mesh cause they think they have too, but it breaks things
yeah my game is kinda depends on high player count thats why i need the repgraph to be optimize..
Bear in mind all rep graph does is (potentially) reduce server CPU overhead. Doesn't save any bandwidth or anything.
@meager spade at first I taught it was because I have a lot of things running through the server
Pls does anyone know anything about auto join team in team death match?
Question about seamless travel: When i join a session (to lobby) the map reloads, as its the first time. anyone knows how to not reload the map?
When you have steam dedicated server up and running how how do you change the name of it?
Just update the Host Settings you created it with
E.g.
HostSettings->Set(SETTING_DCID, m_serverName, EOnlineDataAdvertisementType::ViaOnlineService);
Then you want to get the active session, and call "UpdateSession" on it with those new settings
Ok thank you
Something like this:
if( OnlineSub )
{
IOnlineSessionPtr Sessions = OnlineSub->GetSessionInterface();
if( Sessions.IsValid() )
{
if( HostSettings.IsValid() )
{
if( FNamedOnlineSession* NamedSession = Sessions->GetNamedSession( GameSessionName ) )
{
if( NamedSession->SessionInfo.IsValid() )
{
Sessions->UpdateSession( GameSessionName, *HostSettings );
}
}
}```
copy-pasta but you get the idea
does game state object exist on client before its replicated? what's the best way to check game state has been replicated? i do it like this: in game mode OnPostLogin i call RPC on my player controller to tell client the login was successful. after receiving RPC on client i start checking on tick in my client's player controller if all important objects got replicated (game state and player state for now). i added game state replicated property on the controller and set it on server and wait for it to be replicated before executing further logic. is this a good way?
To answer the first Q: It doesn't exist until it's replicated
What I like to do is put a static delegate/event in my game state class, and broadcast it in the gamestates BeginPlay() function
{
if (GetGameState())
{
DoSetup();
}
else
{
AMyGameState::OnAvailable.AddUObject(this, &DoSetup);
}
}
void ASomeActor::DoSetup()
{
}```
That sort of thing
Or alternatively just have a central "online events" class with a bunch of delegates instead of having them in specific classes
That can be quite handy
or do it even hackier, and do a timer loop ๐
you don't have much choice if you ONLY use BP
@chrome bay thanks, i'll explore in that way
Hey all, wondering why everything here works except for the client can't see the changes to the server. The server and client can see their own changes, and the server can see the client change, but the client can't see the server change. Find it hard to explain these replication issues :D
(For reference: This is to sync up the control rotations which is used in my anim BP for head bone rotation)
you don't need to do that tho
all that stuff is already available client and server
That's what I thought, but then this in my anim BP doesn't work?
Ouch, that was a lot of hours wasted :D
Thank you, that works perfectly!
What udemy c++ course do you recommend on multiplayer?
I have one that is taught by Ben tristem and Sam pattuzzi but it seems as if it won't actually give me enough to understand and start doing multiplayer in unreal
What do you think?
I think that a lot of courses are a bit of a waste. But then I'm not really academic. Multiplayer for me was really easy once I understood the difference between an RPC and Replication, and learned the basic network system and how certain native actor types interact with each other. It's just a bit of reading. If you understand how to develop single player mechanics and systems, multiplayer is very easy to understand once you start grasping those three things.
You also have to deal with things like Race Conditions
and stuff not being ready until its replicated
Speaking of racing... It would appear that getting the owner or controller of my pawn on the client's BeginPlay returns null. Is hacking this in with a delay node the best way to get that controller?
@here is there a way for clients to get their own ping without using PlayerState's Ping property?
@waxen socket that is hacky
i do it in OnRep_Controller (in C++)
but BP land doesn't have that luxuary
I see, yeah. Maybe I'll have to do it in C++ then.
you can just do a timer hacker
Hi! I'm trying to get movement input replication working.
It's very laggy, I'm fairly certain that I'm doing something very wrong with how I'm making it
I play the game with these settings:
The server owner doesn't have any lag, but stuttering and noticable slowness is on every other client
I've looked on forums, but there seems to be no step-by-step way to fix this, only vague answers/suggestions
my setup for moving forward^
If you have any advice, please ping me! ๐
@cloud oriole Is the Pawn a Character ?
Yes
AFAIK you don't need to RPC the movement input then
It should handle it internally
can tmaps be replicated yet?
UPROPERTY(ReplicatedUsing = OnRep_Resources)
TMap<EResource, int> Resources;
hey Im wondering, is it even possible to perfectly replicate physics objects and ragdolls in unreal multiplayer? I know source engine does this flawlessly but I have no idea how to do it in unreal. have any unreal games achieved it?
well from what Ive seen around the internet, its not really possible. anyone know if its any different for unreal 5?
itd be amazing if ue5 is more powerful for things like this
cus seriously how can an engine thats about 20 years old outdo unreal so much in terms of multiplayer physics
quite disappointing tbh
@twin sable No
@oak pond No
And the reason Source outdoes UE is that Source uses Havok, and UE uses the faster but non-deterministic PhysX
UE's Chaos may improve things in the coming years
yeah Im looking forward to seeing how chaos is
I cant find anything about it thats not just to do with the destruction stuff, but I assume its used for everything right? do we know much about it?
It's a work-in-progress physics engine by Epic with a focus on multiplayer and destruction
oh thats good to hear
honestly thatll be a really good feature of the engine to have proper networked physics
when it releasing again?
they're claiming it's both done and not done for 4.26 
Hey, Stranger's advice worked! Thanks!
But now I have a new problem
I package my project, send it to some friends, but we cannot connect, even with the logmein hamachi program
Just wondering if anyone has any experience using Steams's test server (480), I was testing with a friend, (PA to NY) seemed a but laggy at times
Just wondering if that's related to the test server or his/mine internet connection
or if the test server is laggy
test server?
that is just a p2p tunnel
if its listen server, it would be your connections
@gilded vapor I used to use it to test my game before I got my own App ID. I'm in the U.S.A and played with people from the UK and the Netherlands and we were fine. But on the other hand I played with a friend of mine who lives a mile down the street and we lagged like crazy. So I'd guess maybe it's just internet speeds.
@meager spade thanks so its prolly just our crap internet. (It would go inbetween being perfect and jank, and I was testing on a no-ethernet laptop)
Yea that's probably the problem lol.
@cedar finch Did getting your own AppID have any effect on performance?
I have no proof but it feels good me lol. I notice I can find my friends games quicker where as before I would sometimes not find their games or would have random peoples servers in my list for some reason lol.
I know it makes testing a dream come true. I don't have to reupload the entire project every time I want to test. Instead my friends only have to do 5mb update here 100mb update there. It only updates what you change. It's worth it if you do a lot of testing with friends
Especially if your friends are computer challenged and just want to play a game hahahahaha
Oh cool, so you would say its worth getting a store page at least for testing purposes?
You don't even have to setup a store page lol. I've had my app id for about a year and have yet to setup the store page
My friends didn't understand clicking the 'x' on the steam-page doesn't actually close the program
Oh awesome
Maybe a dumb question. how do you go about getting an AppId? I just did a quick google search without much luck
Oh you go to Steamworks website. Once you buy one it is a little weird to navigate and learn but they have tutorial videos and I just wrote down the steps to push updates so It's really easy for me to test. For example sometimes I forget to place playerstarts on my levels because I delete them while testing. So before I'd upload my game, go to test with friends and not spawn. Then I'd have to open up UE4 add the player starts, package, reupload my project, then wait for them to download, then test. It was a pain. Now I can just push a small 2mb update and they'll have playerstarts lol.
you start here https://partner.steamgames.com/
Awesome thankyou so much
bahaha
Named after the famous steam that runs through its historic Gastown brewpub and Burnaby Brewery. Steamworks proudly brews, distinct, delicious and award-winning craft beers.
Thankyou for your help again you guys have all been greatttttt
gabe: "i want to buy your domain how much?" steamworks: "$1,000,000" gabe: "what no that's like an entire day's income"
Hahahahaha
Is there something special I have to do in a mutiplayer context when initializing an object?
AALSCharacter::AALSCharacter(const FObjectInitializer &ObjectInitializer)
: Super(ObjectInitializer)
{
HeldObjectRoot = CreateDefaultSubobject<USceneComponent>(TEXT("HeldObjectRoot"));
HeldObjectRoot->SetupAttachment(GetMesh());
SkeletalMesh = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("SkeletalMesh"));
SkeletalMesh->SetupAttachment(HeldObjectRoot);
StaticMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("StaticMesh"));
StaticMesh->SetupAttachment(HeldObjectRoot);
AIControllerClass = AALSAIController::StaticClass();
}
This constructor appears to run on both client and server (I can make it produce logs) but then all of the class properties (HeldObjectRoot, SkeletealMesh, StaticMesh) are null and cause null pointer exceptions.
i'm trying to test multiplayer, and right now i'm having an issue where players who aren't the host (or all players in the case of dedicated server) can't move. they can turn their camera like normal clientside but it's not replicating.
i didn't make a custom controller, idk if that's necessary
not having this problem in a fresh project
more info: clients can still fire their gun and it will replicate, but their camera movements don't affect where the server thinks the gun is aiming
so specifically the clients can't move and their camera movements aren't being acknowledged by the server
CMC usually handles the movement out of the box @fervent spoke
As long as you try to move via AddMovementInput in Pawn
Also PlayerControllers call ServerIpdateCamera function frequently
And where server thinks your Camera is is also the point from which it calculates distance based relevancy
You can get the updates camera position on server via GetPlayerViewPoint on the PC
You are also very likely get a warning in you output log with more details when something hoes wrong
LogProperty:Warning: Native NetSerialize StructProperty /Script/Engine.CharacterMovementComponent:ServerMove.InAccel (ScriptStruct /Script/Engine.Vector_NetQuantize10) failed.
that is odd
i figured it out
Like your Camera is null on that BP
the values i used were too high
in the character movement component
for accel
i wanted instant accel so i just used a very large number
and it was apparently too large
lol
my camera rotations aren't replicating still though
but i can move
You usually get net serialization vector warnings when you send a compressed vector with something like mouse projected to world while mouse is off screen
You dont need them to move
As long as that screen you posted happens client side
the character model should rotate when the camera is turned
Ah, that
Use GetPlayerViewPoint on server
To get camera forward
Then make rot from x if you have 3d rotation or from zx if its 2d
With camera forward being x and 0 0 1 going into z
is this something i can't do in BPs
even without the context checkbox ticked i don't see it
You can manually replicate rotations as well
I am not 100% on the name tho
Bp functions can have different names then c++
You do need to pull it from GetController Cast to PlayerController ref tho
You mentioned you dont have custom PC and GetController returns a Controller not PC
Dont think thats it, and im on mobile not near a pc so cant check
Alternative is to send an unreliable server RPC to update rotation
i'm not clear what you're telling me to do even if i had the node
On tick or when it changes
And have a replicated rotator variable with skipowner, which sets the rotation onrep
With the node youd have the clirnt camera forward vector
And you can work out the rotation ftom there
to do what though
Set pawns rotation
i already have the camera forward vector
and things rotating with the camera
it's jsut client side
for example if i use a listen server, the host's camera movements can be seen by the other clients
yeah
Only way for client to send data to server is a server RPC
In case of camera position and direction, engine already foes it under the hood
Im just not sure how exposed it is, was pretty sure that it is until now
so were you saying to set a rotator variable to RepNotify, get the camera's rot, and then with the onRep change the camera angle to match this variable?
Where other clients think your camera is is usually not important, as long as pawns rotation is correct
But yes
well the server doesn't know where i'm aiming
And i cant stress this enough - SkipOwner
It the server starts correcting owning client on non predicted movement, youll end up with horrible jitter
yeah
If you havent already
There is a link to network compendium in pinned messages on this channel
Strongly tecommend giving that a read
ite
how does the server tell the clients which character they should be rotating
e.g. client 1 rotates, the server gets told what its rotation is.. how does the server tell client 2 that it should be rotating character 1
o nvm i got it
think i'm being dumb because it's 4:30am should go to sleep
thanks for the help @winged badger
each client + server have their own instance of Character1
Unreal doesn't replicate pointers, as memory address would have no meaning, but rather each Actor is assigned a NetGUID
and each Actor that replicates has its own ActorChannel over which it replicates
@winged badger GetPlayerViewPoint is not exposed, i did make PR for it to be exposed but they haven't even looked at it lol
that figures
kinda? its outright sloppy
Hello guys
How do I implement friendly fire
Like disable friendly fire in team deathmatch
Just check the team of the weapon's owner on hit
i made a filter struct
which checks lots of things (like can damage buildings, can damage AI, can damage friendly ai, etc)
and i run the hitresult through that and it spits out if it can apply damage
Hi, so im trying to replicate my actors with skeletal mesh just using ReplicateMovement. it seems client is laggy updated from server, while characters aint.. any idea?
"Replicate movement" is really "replicate transform", does not handle movement
yeah there is no smoothing its just, actor is here, now here, now here etc
so it will be horrible
I have an GameplayAbility that stuns the target. The ability itself (the attack that stuns) is locally predicted, the resulting stun effect however is set to server-initiated.
Is it okay to have the stun local-predicted?
I've read that its awkward to local-predict damage/stunning, does anyone have any experience if this is true?
I imagine that it would improve game smoothness when it predicts correctly (though it would look worse when predicts incorrectly)
stun should only happen once the server confirms that stun can be applied
else player could get stunned in a fight for no reason
and that would be horrible
he means predicting the stun of the other person, locally.
so you hit someone, and stun them, but you see them stunned before they actually are, assuming the server will accept it, so if you have 300 ping, there's no visual delay
and my take on that, sometimes it's okay. but in previous games I worked on many years ago, we had stuff like that, including playing the blood on the client side traces
and it ends up pissing people off, because they are sure their shots are hitting
when they really aren't
so we changed it so blood and stuff is dispatched from the confirmed damage, later, even with the ping delay, and everyone was happy
it's a balancing act really
non-consequential things are nice to predict, because it makes it smoother, but some things cause more confusion
My current issue is that I have a guard ability that plays a specific block animation (based on the hitresult) and having any delay between the two is super awkward. (In really latent situations the player could stop guarding but than jump to the successful-block animation)
So I think that may cause more confusion in really latent situations?
i know what he was on about
and i stated, stun should only be authorized by the server
it didn't sound like it "else player could get stunned in a fight for no reason"
especially if it stops the player being able to move/attack
it sounded like you meant you could stun someone else
or be stunned, when you shouldn't
which is not even the case at all
A successful block effectively stuns your character for about a quarter of a second
yes, if it was predicted, player could be stunned when they were not actually stunned
it's you hitting someone else, and locally making the OTHER player look like they are stunned
even if the message hasn't come through yet from the confirm
so it is "smooth"
not predicting yourself being stunned from someone else maybe hitting you
that make no sense
becuase if you're able to receive an event that would cause you to predict yourself being stunned by someone else
you would be receiving the confirm from the server
so therefore you should actually be stunned
ah okay
i missed that one line there
you're saying
when YOU block someone else
YOU get stunned?
i thought you were talking about hitting someone else, and stunning them
my bad.
If you block an attack you get stunned, though ideally it should be smooth both ways
Maybe in magical fairly tail land I can predict the block on other targets, and have it server initiated on my own
in my other game that is down now, we had that with knives
you can block
and we did predict that actually
i just have a rule of thumb, anything that can alter gameplay and can cause confusion, should not be predicted. Like when i fire a weapon in my game, i show the muzzle fx, and the trail, all locally, but the actual hit confirmation (hit marker, impact, blood, etc) only happens on server confirmation (non predicted)
however, it's different engine.
woot woot GAS
but i only have basic stun, ie stun grenades, that kinda thing
not blocking stun from melee attacks
oh wait, no i am wrong. we didn't stun the person who bocks.
we stunned the person attacking
Yeah I'm gonna test the local-prediction and see if its better/worse, its a little bit awkward to see a sword go through your character and than get staggered .2 seconds later
if they hit a blocking player, THEY are stunned, not the player who blocks
If you hit a blocking player the blocking player is stunned
yeah you're doing the opposite.
(though there will be deflects, so if you get deflected you get stunned)
So i actually need to handle both cases
ours was more like.. for honor
if you block, you aren't stunned, you can counter.
the person hitting your knife is the one who gets stunned, because they were blocked, giving the defender the option to counter-attack.
Our block is like in Sekiro where if you have a succesful block against a heavy attack you have a small "block animation" that prevents movement/abilities
If you deflect its the same jist where you get to counter-attack
well either way i refer back to what i said before about it being a balancing act, i'd almost say just test it a lot, with various pings
determine how often it actually fails
if it seems too flakey to predict, then don't
if it ends up being reliable, go for it
you may still get the random case where it does fail, but if it's within an acceptable threshold
and if it only happens after like 1000 ping, then that's acceptable too
or hell even >500
yeah i test with 300 ping
action games are not really playable without prediction anything over 300 usualyl
its like a good testing ground
and anyone expecting them to be smooth is delusional ๐
Would either of you know the average ping on a p2p system?
depends on the host, and the distance from host to players
NAE to EU would be around 70-130 ping
for example
on a good connection
that's kind of hard to judge. best is to just shoot for something reasonable that everyone knows
as a baseline.
like the 300
300 is what i get playing with australians
as your top end of "it will never be smooth after this, no matter what"
something kind of funny, with counter-strike
in the early betas, i think all the way up to 1.6 for that matter
everyones ping was artificially modified on the scoreboard
-10 or something
Lol for what reason
cuz people wre bitching about it, and so minh was annoyed, so he just artificially reduced it and said "optimized blah blah"
and everyone believed it
noone complained again
That's amazing
i did something similiar in another half-life mod at the time, with damage lol.
Good morning. Should pawns always be spawned on the server?
Thanks, Jambax. And in that case, the server owns the pawn?
Once it's possessed, who owns it?
By default the player possessing it IIRC
Since possession explicitly sets the owner to that controller
So then a RunOnOwningClient RPC would run on... the server?
It would run on the client who is the owner of that pawn
If a client doesn't own it, it would run on the Server.
So...
Spawn a controller on a client.
Spawn a pawn on the server
Possess the pawn.
Pawn RoOC now runs on the client?
You wouldn't spawn a controller on the client
Oh.
anything relevant to the network is spawned server-side - always.
If you spawn that on a client, it only exists on that client and nothing else will know about it
I see, but player controllers are at least owned by the client using them.
They're owned by them yeah, but the server is still the one who spawns them and has authority.
Ownership != Authority
They're two different concepts
Okay, I think that has confused me till now.
A connection has authority over an actor when:
- The actor was spawned on that connection.
- The actor has been "torn off" by the Server.
Ownership is explicitly set with SetOwner() (Server-Side). That determines who has permission to call Server RPC's on that actor, and who will receive client RPC's for it.
I see.
I expect that if you call a Server/Client RPC on an actor that you spawned client-side, it will probably execute on that client - but it's not a usual code path so I'm not sure.
And do you have similar feelings about RoOC as you do about Multicast?
Client funcs are okay, usually they're pretty specific
Multicast is okay btw ๐
But for states or very frequently repeating effects, I prefer vars
You've taught me to hate them.
Everyone else tells me to use them but I follow the way of Jambax.
Like say, a chat message. You wouldn't want to replicate a TArray of chat messages, so sending them via reliable multicast would make more sense.
So here in the eXi bible, it says "Un-possessing it will result in the Client no longer owning the Pawn."
So on unpossess, the server becomes the owner of the pawn again?
I actually think they don't have an owner once unpossessed
Oh. That's so sad.
So by default, nothing has an owner unless you spawn it with one.
But Possess/Unpossess makes calls to SetOwner() to explicitly set the owner to the controller
Or clear it in the case of unpossessing
๐
I'm struggling with some timing issues in Blueprints right now. My ship tries to access its player controller before it's possessed and it throws an error. I was going to try making a hacky "validity timer" but now I see I can override Possessed() in Blueprints so I'm gonna try that route.
That may work, I'm not entirely sure how/where those get called.
In CPP, the most reliable place I've found is AController::SetPawn();
Oh, yeah you know what it may well only happen on the Server.
Wouldn't surprise me
And since you can't override the existing OnReps in Blueprint... RIP.
Yeah, looks like those functions will only fire on the Server
Yeah, I just gave it a quick try. No luck.
This is one of those "basic networking shit in BP is a pain in the ass" moments.
But yeah you'll just need to check and cast the controller when you need to use it in the pawn to get around it
I suppose that's fine. I can do it in the spawning animation before I even give control to the player anyways so no big deal.
Actually, I think I got it working with OnPossess in the controller.
Nope... Ah well. Thanks again for your time today!
do i have to use ustructs when i make it a ufunction?
i got a snake game and im trying to send the servers location list to the clients real quick at begin play, but my tarray of locations is a TArrray<struct myvector> so itll be lightwieght lol it saves alittle data having a custom vector of just three variables and no mem functions,
I use default movements for my character, and when i host multiplayer game, on all clients replications look perfect (movement + animations), but on server (host player) it looks like they in low fps or something like that (movements + even animations). Anyone know how it fix it?
I don't use any RCP functions
how you guns implemented foot step sound in FPS multiplayer ?
i made a footstep component, that just runs locally for everyone based on movement, since i didn't care about syncing with actual feet animation.
the timing makes it pretty close, just not perfectly synced.
hey guys, im having a problem with calling a RPC
Ok
So i want to change the color of a pawn when it has less then 0 health, and right now when i call run on sever from the blueprint of the guy that died, it doesn't call the server (i need that so i can send a multicast to everyone to change that pawns color)
you cant send a RPC to the server, if the actor is not your player char or controller
you also should never allow RPCs to the server for NPCS, the server should decide to set the color
this is not from a NPC
@gleaming niche I wanted to do the same but didnt know what to write exactly, since I have crouch, walk, run and what them to be heard by local client.
currently I am trying to use anim notify ๐
this is in the thirdpersoncharacter BP
i referred to it as pawn as that's what the other clients see (i think)
they don't get the full player controller, right?
they don't get the player controller at all, just the owning connection
If you are not the owning connection, you can't send an RPC to the server
how do i tell if im the owning connection for a player
Locally Controlled -> Owner
But why do you need to send this to the server anyway?
The server has authority on life, he should know when its 0 and multicaste what ever you want
that is my health check
oh
that makes sense
its my first time trying to do multiplayer. Its confusing man
besides that, you don't need the multicast at all
just replicate the health and do on rep health a check if its 0 and set the color accordingly
how do i check for overlap between a projecile and player on server side only then?
you shouldn't, since you maybe want hit response simulated
just guard your functions with an authority check / is server
so currently the projectile detects overlap with a player across all game instances and players, and calls the take damage function on that player ( on all clients and server instance of that player)
so i should put a authority check before the take damage function, so that health is only calculated on the server?
well you can simulate it client side, but then you need to reconcile if the prediction was faulty
๐๐ป
would anyone be willing to help me with some server/client physics replication and desync issues?
i think i just need someone who understands it better than I do to help explain whats going wrong
im trying to do the physics server side, and it all works fine, but im not sure how to sync the client's view to be what the server sees
how do i get the transform that the server think's is correct from the pawn BP of the client?
nevermind, i figured it out
i was just being stupid
@dull flame what was the solution?
@queen flower i was making everything way too complicated with multicast functions, and didnt realize that when setting the component to replicate, i think that automatically sets the client's transform to be what the server has? From there i just made all of my physics called on the server, and it would auto replicate down to clients
i think that was what's going on, but i could be wrong and just lucky
im having basic level issues too with understanding what the types of replication are
i can try and help, but i dont consider myself very good at ue4's networking
like, 2 players can join the same game, but using the top down template, I cant seem to get the client to move.
the client to move at all, or is it not moving on the server's screen
are you using the steam subsystem stuff and all that?
server moves fine for client and server
k
yea
dont think id be able to get 2 players into the same game without those subsystems
idk i would try and debug by looking at if the client is even possessing a pawn in the first place
and then look at how your putting the input into said pawns
cause if it was a replication issue, the client would move around fine on its own screen, just not the server's
im pretty sure
just one but i think you can use more
i just have one, and then move the host out of the way
try to turn the auto input off on the player start
and make sure "auto possess player" is off in your pawn
i find that with networking things, whenever i try and do something pretty basic, the defaults tend to work for most things
i totally get the whole "im just gonna change a bunch of things and lose track of what i changed" cause i just finished doing that for 2 hrs lol
lol I am just following mixed information online
yeah i feel that
?
well, cant get movement to work still
but I didnt change anything beyond those player starts
i would reset the player start to all defaults, ive gotten everything i need without changing them
the topdown template handles movement a little differently