#multiplayer

1 messages Β· Page 450 of 1

thin stratus
#

With 80 ping

#

and bam, same corrections

chrome bay
#

One thing I do have is when the server receives the move it checks the input is valid as well - if not it just sets it to what it thinks it should be

#

Urgh

#

in some ways I miss the kinematic movement.. it was so server-auth and hacker un-friendly 😦

thin stratus
#

You override PlayerInput?

chrome bay
#

Yeah so say the local player thinks they can sprint but server disagrees, just clear it on the server before simulating

thin stratus
#

I mean, yeah guess that's a thing

#

Ah, yeah I do that with a "bWantsToSprint"

#

So it's not like Sprinting is replicated

#

But the request to sprint is

#

If that's not possible, nothing will happen anyway

#

The boolean can stay true, cause well, he wants to, but damn he is not allowed!

chrome bay
#

yeah that makes sense

thin stratus
#

Oh also, I ended up sending the whole information about hovering to the Server

chrome bay
#

God I hope chaos makes this easier

thin stratus
#

And not recalculating that

#

Also not per SubTick anymore

chrome bay
#

I want to go back to server-auth so bad

thin stratus
#

Cause I figured it is really not all that important if the distance or floor normal changes during one tick

#

And if Client and Server have the nearly the same normal and distance, server just takes the client one

#

Removes all sorts of desyncs

#

Chaos would hopefully just allow us to apply a Force at 4 points below the hovercraft.

#

And then magic.

chrome bay
#

Ah yeah makes sense, I'm getting a new floor on sub-ticks but keeping the same input

thin stratus
#

NewHoverAcceleration = FMath::Max(0.f, HoverInfo.DistanceToFloor * (GravityStrength - MaxHoverAcceleration) / DesiredHoverHeight + MaxHoverAcceleration);

chrome bay
#

I'm just hoping it lets you simulate a single object at once, then most but not all my problems would be solved

thin stratus
#

I replaced the HoverAcceleration PID Controller with the above

#

Cause I figured the simpler the equation, the better it stays synced

chrome bay
#

That's pretty much the same as mine

thin stratus
#

The equation solves:

f(h=0) = f_max
f(DesiredHeight) = Gravity;
f(h > DesiredHeight) = < Gravity
Where h is the current height to the floor.
f_max the maximum acceleration.
DesiredHeight the height at which we want to keep floating.
chrome bay
#

One thing I don't do is cache the spring length and use that to work out spring velocity

#

Seems to be more stable if I just update it on the fly

grand kestrel
#

How do you remove/disable the replication graph in a project? I removed it from the .ini and it just uses the base version

chrome bay
#

Oo good question

grand kestrel
#

Oh disable the plugin

chrome bay
#

Oh right yeah

#

hahaha

thin stratus
#

One thing I don't do is cache the spring length and use that to work out spring velocity
Right, it's calculated in the same tick, just a different functions for me.

grand kestrel
#

Seriously the replication graph is so gross

thin stratus
#

haha

grand kestrel
#

Needs a lot of work

#

I think Fortnite is the only game that actually has any reason to use it

chrome bay
#

we've been using it on HLL

#

It's a nightmare

#

SO many crashes

#

I get why it's beneficial, but I honestly don't know how Epic have got away with using it in it's current state

grand kestrel
#

Helps when you have the guy(s) who made the thing

#

I bet half the code to make it usable is in Fortnite itself

#

If we're lucky they'll slowly move it over

chrome bay
#

Oh definitely. We've subclassed it and the like, but I'm still not convinced it's ready yet. We had it replicating pointers to GC'd actors and crashing the engine... rip

nocturne berry
#

Hey guys, in a top down game, i want to rotate the character towards the mouse. I am using an server RPC which receives the rotation from the client on tick.
when i profile the RPC calls, the number is huge like 20k+ in less than a minute of gameplay.
what is the best way to keep updating the rotation on the server and reducing the number of RPC calls?

thin stratus
#

Well, you do need to send some sort of data

#

As long as that's Unreliable and the only call and only sending very limited data, it's fine

nocturne berry
#

@thin stratus how come the built-in ServerUpdateCamera function has much less call count than mine, even though both are in the event tick?

thin stratus
#

Same actor?

nocturne berry
#

yes

#

using 1 actor in the scene

thin stratus
#

Actually not sure without looking into it sorry

worthy perch
#

Did you change the NetUpdateFrequency? The default of 100 is quite high.

nocturne berry
#

@worthy perch no i've kept it to 100, how much is a "Good" value?

worthy perch
#

I'm not too sure myself, but ~10 appears to be decent.

nocturne berry
chrome bay
#

Changing NetUpdateFrequency won't change how many RPC's you send

worthy perch
#

Oh, I didn't know those were RPCs. I guess I'm tired...

#

Well, you could reduce your TickFrequency.

chrome bay
#

I would strongly suggest using character movement component to modify character rotation

#

Depending on what you're trying to achieve it might already be available

worthy perch
#

Do you need to do such a thing on Tick as opposed to specific events?

chrome bay
#

You want to be really careful with modifying character transforms like that for multiplayer because it almost certainly won't work correctly with prediction and replay

nocturne berry
#

well if i reduce the tick then the other functions that are used locally would get affected too

#

@chrome bay i don't think the character movement component has what i want, as i have tried to see if it does, and searched online, and found nothing. might be wrong though

chrome bay
#

What's the desired effect?

nocturne berry
chrome bay
#

Setting the character movement to follow Control Rotation, then setting the control rotation of the controller to look at the mouse is the best way.

nocturne berry
#

yea but then i'd have to send the mouse location to the server, right?

chrome bay
#

Control rotation is already sent to the Server via character movement so no

#

And the benefit is it then works properly with prediction and replay, and you get all the benefits of character movements netcode

thin stratus
#

If you can stun a player so that they can't move, I would most likely check on that inside the MovementComponent, right? -_-

#

Having the AddInputVector in BP but all the rest in C++, specially the ServerCode, does create a lot of annoying situations if you want to prevent cheating

#

Guess I could just set the MovementMode to None

thin stratus
#

@chrome bay Any idea how to sync running out of energy when sprinting?
I get 0 corrections when starting and stopping (even if rapidly spamming the key), but the Energy variable isn't 100% in sync, so it's not 0 in the same frame for both server and client.

#

Also can you just release your amazing movement components?

#

!

chrome bay
#

hahaha

#

Hmm. I guess if movement is driving it, it has to be saved/decremented as part of the move?

#

When MoveAutonomous runs maybe decrement the energy value there?

#

Otherwise hard to say

thin stratus
#

Gnah that would mean I need to move energy into the MC

#

(β•―Β°β–‘Β°οΌ‰β•―οΈ΅ ┻━┻

#

Or at least somewhat access it via that

#

Does a client call PerformMovement more often than a Server?

chrome bay
#

Yeah or some kind of delegate that broadcasts to update anything that should effect movement?

#

Most of the time probably yeah, at least if your combining moves and throttling outgoing and suchlike

thin stratus
#

It would need to be two events that call exactly the same amount of time

#

Cause otherwise the server might reduce later

#

Or earlier

chrome bay
#

I guess they're being called with the same total delta time though right?

thin stratus
#

Yeah but if the Server doesn't call it in Frame X and energy would be 0 in that

#

Then the Client would set it to 0 one frame earlier

#

or even multiple frames

#

I mean you can't really see anything related to that correction

#

But it annoys me

#

Cause it's so obvious why it happens

chrome bay
#

waiting for that "make multiplayer" button πŸ˜„

thin stratus
#

One day

#

When we are 70 and half our brain isn't functioning anymore

#

Someone just has a "make mmo" button

chrome bay
#

I do want to release that movement framework as a plugin btw I just really need to polish it a bit, and it's never going to be a kind of plug-and-play thing 😦

#

So many ties between actors and movement

thin stratus
#

It won't ever be. The only thing you can do is make tons of Pawn Classes with their specific Movement Component

#

May it be Vehicle, Hover, Fly, Character

#

And then leaving enough space for people to customize it

#

So that your character doesn't need a capsule etc.

chrome bay
#

This is one other tiny advantage of the physics approach is that's taken care of then too

#

Urgh

#

Chaos better have a nice way to handle this crap

#

If PhysX wasn't hidden away behind so many layers and let you simulate one object at a time of your own accord life would be much easier

thin stratus
#

Ultimately you want something that works with every collision shape

#

And also accepts physics simulation for multiplayer

#

Then we are all happy

chrome bay
#

totally

#

A problem as old as multiplayer gaming πŸ˜„

thin stratus
#

Well I've seen a chunk of PhysX code when trying to find out about the angular damping shit

#

And it doesn't look taht bad

#

But also not really something for networking

#

The main issue I still see is that Physics Objects aren't deterministic if you aren't looking at all of them at once

#

A 1x1 dust corn could move your bullet slightly upwards and it would hit a ball in a differnt angle

#

In the non-physics approach you just ignore all of that

#

Isn't static and blocking? F+ck it

#

Even though I still have to add the "CanInteractWithPhysics" stuff

#

Cause I currently can't move physics objects with the drone

chrome bay
#

Yeah I copy-pasta'd that from character movement, but it's so fugly the way everything interacts

thin stratus
#

I cut away 90% of the code for StepUp and MovementBase

#

I see myself re-adding the movementbase stuff cause the drone won't be able to hover on a moving platform otherwise

night jay
#

Is this the place to ask about Epic Online Services?

thin stratus
#

Yeah, it's find to ask here

#

Don't have a dedicated channel for it

night jay
#

Alright, I'm a bit confused on it. It is a bit unclear on whether we need the game to be on the Epic Games Store or not in order to make use of the services

thin stratus
#

Well, as of right now, you can't make use of the Services, despite maybe the Ticket System

night jay
#

Metric system aswell iirc

thin stratus
#

Yeah couldn't remember the name

#

Iirc the Documentation currently has a EGS ONLY banner

night jay
#

But the weird part is, the metric srrvice mentions you don't need the epic games store. But it does say it relies on the Platform interface, which does only work with the store

thin stratus
#

On most of the other services

#

I would assume that as of right now, the systems won't work outside of the EGS

#

And you don't get your hands on them without Epic letting you in

#

The EGS will be opened up later the year

#

And the Roadmap for the EOS (!= EGS) says that it adds stuff like Identify Interface later the year

#

Which, in what I understand and think, means that at that point it will be available for everyone

night jay
#

Quoting from the overview: The EOS SDK exposes its interface through opaque handles, which are provided by the Platform Interface. An interface handle's lifetime lasts as long as the Platform Interface itself, and is required as the first parameter to every API function using thst interface.

#

It seems that the interfaces, even those who state they don't need EGS, need that platform interface, which does need EGS

solemn hedge
#

anyone know how you can test if your connection is secure on xbox multiplayer?

thin stratus
#

@solemn hedge Anything console related is kinda NDA. You should stick to the UDN.

#

@night jay Platform doesn't have to mean EGS

#

@night jay Platform could also refer to PC, PS4 etc.

#

Similar to how the current Subsystem Interface works

#

That doesn't necessarily need a store behind it

night jay
#

It is referring to the Platform Interface

#

Which is in bold and capitalized in the text

#

And that interface is apparently what drives the whole SDK

thin stratus
#

Will have to see what it becomes in the end

#

It generally can't be fully connected to the EGS

#

As then you wouldn't be able to use it on Switch and stuff

#

Cause EGS won't ever be on that

#

The EOS sits behind all of this

#

the EGS communicates with the EOS for Entitlements and Friendlist etc.

#

But I would assume you don't need the EGS at all

#

You could even write your own standalone software for pc

#

At least that's what they kinda promised with "You can use it with every store on every engine on every platform."

night jay
#

Yeah, it is still a bit vague though, would be nice if they cleared up some of this stuff

thin stratus
#

I tried pinging them, but I think mostly the Community Managers are using the Twitter account and they were probably busy during GDC

#

Might be worth trying again

ivory portal
#

This is maybe an editor problem but I'm checking client side on the pawn if the pawn is moving, if he doesn't do anything the AFK will open-level to mainmenu (this is all behind a switch-has-authority with remote pin). When a pawn does open level back to the main menu all the others follow? Is this only an editor problem?

thin stratus
#

If you check on the Pawn and you only filter with "Remote" then it affects all

#

Remote is all Clients

#

You have to also either do "GetController" and check if that is valid

#

Or "IsLocalyControlled" with a branch

#

To limit it only to the local pawn

ivory portal
#

oh, because the pawn exists with all the other players

thin stratus
#

Yus

#

You could also just check it on Authority

#

And ClientRPC if they need to leave

#

Then they can't cheat the afk system :P

ivory portal
#

alright it works now!

#

Thanks

thin stratus
#

Sometimes

#

No, your question is largely answered and can be found easily via google.
I'm not supporting your ever lasting spam of questions, Crusher.

bitter oriole
#

"UE4 multiplayer tutorial"

thin stratus
#

@north stone Can you help this lost person? He doesn't know how to use google!

#

I still don't understand that question tbh

north stone
thin stratus
#

I'm surprised you actually did a serious video on this

#

Don't want to see Allar's approach

north stone
#

Allar be going "this is google USE IT!"

thin stratus
#

"Ayyyye. Google."

ivory portal
#

After today the EU will not be happy you are using Spongebob in that movie

thin stratus
#

The ControlRotation that the CMC uses, is that Gimbal Lock free?

#

I previously used my own RotationVector that I passed to the Server

#

But would much rather use what Epic already has

#

Just wondering if I can easily do 360 movement with that

trim oriole
#

@north stone i love your video ill be sending a lot of people over to watch it πŸ˜›

north stone
#

I bet its harder for very specific code-things, but no experience with that hehe

limber mortar
#

Right now I want this code to proceed if the testing volume object is not in the way. If a testing object is present it breaks out. This works:

#

Is there a more efficient way to do this server side, check for an object at a location? I also need to acquire to terrain location at the same time. By using either an overlap runtime, or putting in a collision sphere in an actor and detecting that overlap at runtime.

#

I need to be able to get landscape level and certain actors. Right now location calculations are made during runtime. This actor spawns in a different location each time. Location it's not static, but the point checked is always a certain distance relative to the actor.

#

I imagine if I put an overlap box in the relative location, into the actor blueprint itself, it would save the effort of calculating the location during runtime, but add time to the creation of the actor because another component object would be present. This actor is created many times during the course of the game

keen thorn
#

@limber mortar overlap events are prolly what u will need, more efficient u gotta implement ur own data structure and search. But overlap events are already good enough

languid sapphire
#

Hey if I'm setting up a dedicated server, and say my game executable has custom stuff in GameInstance, GameMode, etc, does the server also need the code for that? and if so, do I have to package separately or how does that work? I'm following the tutorial from @worn nymph but I'm slightly lost

winged badger
#

only the server will have a GameMode, for one

languid sapphire
#

Oh okay, so build a separate build of the project specifically for the server? orrrrrr....

winged badger
#

most of the code is common to both server and client

languid sapphire
#

okay so what would be the exceptions?

winged badger
#

anything behind HasAuthority will be dedicated server only

languid sapphire
#

i'm anticipating integrating playfab into my game, so i'm trying to get my dedicated server setup to experiment with that

winged badger
#

anything behind IsLocal<whatever> will be on clients

languid sapphire
#

well i know about authority switches, but as far as actual classes

winged badger
#

GameMode and GameSession will be exclusive to server

languid sapphire
#

correct me if i'm wrong, but the dedicated server is essentially the same code as the main project but just set to run as a host?

winged badger
#

more or less

languid sapphire
#

so rather than a local listen server like i would test with, you'd just connect to the instance hosted on the dedicated server

winged badger
#

dedicated server doesn't need to render anything

#

doesn't need to tick animations unless your hit calculations depend on them

#

doesn't need to play sounds, spam decals, have any UI

languid sapphire
#

okay gotcha. so i shouldn't make a seperate project, i should just build logic to test if dedicated server is running and have that run on dedicated server launch?

winged badger
#

you can't make it a separate project

languid sapphire
#

okay gotcha

winged badger
#

but you do need to compile separate binaries

languid sapphire
#

okay so do i need client binaries with the packaged server?

#

or client content or such?

winged badger
#

any asset you want to reference over network... ever

#

server has to have

#

its not 2 projectse

#

if you tried connecting to a dedi in separate project you'd just get a class mismatch and get disconnected

#

pretty much right away

languid sapphire
#

oh so packaging the server requires me to just place it with the client binaries and launch from the project folder

winged badger
#

i think VS will do it for you, the placing

languid sapphire
#

oh okay cool

#

another question

#

i have most of my team working with the pre-built binary version of ue4.21. if i compile the project for dedicated server using the source built version, then they package the project using the pre-built binary version, will that cause issues or will it work just fine to connect to the dedicated server?

winged badger
#

afaik, it shouldn't cause issues

#

i don't work with dedicated servers, but i often have binaries prebuilt before i start packaging

#

you might want to get confirmation from someone who actually packaged a dedi for this one, though

languid sapphire
#

i'm doing the programming for the whole project, so any pointers for how to avoid that sort of problem?

#

my team is mostly artists, so i don't want to have to worry about them learning to compile from source, but also make sure it doesn't break if the client uses pre-built ue4 and the dedi has source version

winged badger
#

don't let them do the packaging πŸ˜„

#

your average artist won't be able to make heads or tails from a packaging error anyhow

limber mortar
#

Thanks madlios, I guess I need to figure out the most efficient way to use overlaps then. I have a few different ideas on how to apply them.

#

I mean I know how to make something overlap, and fire events, lol. But if I can shove .05-0.10 ms off a process I need to do so

#

first I think I'm going to take my calculations to determine those overlap locations out of the blueprint, and put the spheres in the blueprint directly

#

see if that speeds things up

winged badger
#

@limber mortar #multiplayer is not the optimal choice of a channel to discuss performance optimizations not related to networking ^^

limber mortar
#

I needed to know if a server would handle one better than the other performance wise

#

was my original question

#

or part of it

winged badger
#

nod

limber mortar
#

but I understand if part of my question might not be applicable, I'm in my first year using UE4

clear copper
#

Is GameMode replicated? When a client tries to Get GameMode it says none but the host player gets it no problem

clear copper
#

ah i missed that slide

#

thanks

rocky badger
#

Is there a good way to get and cast the controller to a custom controller for multiplayer purposes? Trying
ACustomController* controllerRef = Cast<ACustomController>(this->GetController());
gives me NULL everytime and I don't know if it's smart to use the 'GetPlayerController()" function from UGameplayStatics

gleaming niche
#

client's only have a controller for themselves, not other people.

rocky badger
#

so what you're saying is that my code is fine but the fact that I'm running it on one pc is the issue
or
i shouldnt call my custom controller from the server ever because when it does, itll call its own controller

#

or did i just completely miss the point

keen thorn
#

@rocky badger each pawn/character has a their own controller on server. on the clients only the player controlled pawn has a controller

#

for AI controllers then only server has it

#

clients have none

molten prism
#

how about dedicated server memory cost? if we have multiple match, so i will start multiple dedicated server processπŸ˜€

bitter oriole
#

Measure it

#

Depends a lot on your game

graceful cave
#

if i have a replicated array and it gets updated, does the server send out the entire array in the update or just the changed data?

bitter oriole
#

Should be only changed data

graceful cave
#

thanks

stoic acorn
#

@sharp pagoda that PDF is a TREASURE TROVE . Thanks for posting

thin stratus
#

You are welcome.

stoic acorn
#

Yes, main thanks to you @thin stratus this is a really big help.

rain coral
#

If I want to host a server from the main menu, and start 'listening' without doing a map change to a lobby (the lobby is integrated into the menu), how should this be done?
Should clients always run the main menu with the -listen paramter in case they want to host? Or is there a way to initialize a -listen without reloading a map?

meager spade
#

host is not determined until the map starts

#

so main menu doesnt matter

rain coral
#

Hmm, but I want to get players connected to me when I create a lobby, in the menu. Using the advanced sessions plugin. Don't I need to be a 'listen server' at the point where I accept joining players?

scenic raven
#

my setup is more or less the following. PlayerControllers own a Pawn, that acts as a movable camera. The actual characters controller by players are Characters possessed by AIControllers. When a PlayerController needs to control the character it will call RPCs on the server to give commands to the AIController. My characters are setup as ROLE_SimulatedProxy. Unfortunately SimulatedProxy is incompatible with the GameplayAbilities plugin. Is there a simple way to make my characters AutonomousProxies and still work properly?

#

I am sorry if the question is convoluted. I guess it's because I don't have a proper deep understanding of the topic yet.

meager spade
#

@rain coral you need to create the session

winged badger
#

@scenic raven make sure you SetOwner of the AIController to the PC

#

and just for good measure, make sure your Character's owner is the AIController as well

#

as some methods of spawning it like SpawnAIFromClass, will fail to SetOwner on the Pawn

scenic raven
#

Thx for the tip. I’ll double check the owners are correct.

winged badger
#

without the ownership chain, you can't RPC anything from either the AIController or the Character

#

also, your AIController is not replicated by default

#

but for this setup, an exception is warranted

#

without having the client side AIController, that ownership chain will break

subtle patio
#

Is this utter, plain and simple doodoo practice

#

do notifies get called recursively?

#

( I presume not )

jagged stag
#

Is it possible to use a skeletal mesh physical asset for collision in a pawn in multiplayer?

#

I've been trying to figure this out for hours with no result

#

best I got was colliding with static meshes but it didn't react properly with other pawns no matter what i tried

amber plover
#

I had a bit of a question about change static mesh replication, so I made tweet chain here with all the details, can anyone help me to where I'm going wrong?

https://twitter.com/mnrART/status/1111011358819209217

It don't want to change the static mesh on my clients, but if i set the replication to multicast i changes it on the client but don't updates it on the other clients.

I'm a bit newbie artist not programmer so please explain it a bit user-friendly

unreal pals need some heads up on replication, please see the full Twitter chain for context. #ue4 #noob #help

winged badger
#

@subtle patio OnRep in BP is moreofa setter callback then RepNotify, it will get called locally on a machine that did a manual set of the variable, even if its a client

#

that screenshot of yours, it looks like it heads into stack overflow

#

@jagged stag collisions work the same multiplayer or not, but fully syncing a physics assets tends to be problematic

subtle patio
#

@winged badger Interesting.. thanks

tribal solstice
#

How difficult is it to get a VR game replicating movement in a multiplayer game? I'm wondering if I should use something like Proteus template or if I should just build from scratch. Can't really find much documentation in that area.

gleaming niche
#

lots of multiplayer support.

tribal solstice
#

@gleaming niche Fantastic, I'll take a look at that. Thanks a lot.

jolly siren
#

Does anyone know if NetUpdateFrequency is used for the initial replication of an actor itself? Or is it only used for properties on that actor itself?

nocturne berry
#

@chrome bay just wanted to say that your suggestion for using the control rotation worked perfectly! thanks a lot

red ledge
#

what is the last function called when a listen server gets shutdown, exits?

#

AGameModeBase::Logout(class AController* Exiting) doesn't get called

#

if someone enters the quit console command

#

or uses the X button

thin stratus
#

It should though after a short time?

red ledge
#

I need a place to unregister the server in

thin stratus
#

Doesn't that count as ALT+F4 basically?

#

So a DC?

#

Unregister the Server from Backend?

red ledge
#

yeah it should be like an alt+F4

#

any exiting method tbh

#

yes from a mater server's server list

thin stratus
#

Custom one?

red ledge
#

yes

thin stratus
#

You are lacking a Heartbeat

red ledge
#

I could ping every now and then

thin stratus
#

That would take care of it

red ledge
#

but I was wondering if there was something easier

thin stratus
#

No, Heartbeat is what is used for this

#

Server pings the MasterServer

#

If no pings come in anymore -> remove

red ledge
#

oh okay

#

guess I will have to do it

#

thanks!

thin stratus
#

You have to anyway

#

If the PC goes out there won't be any event being called

#

Then you'd have a dead Session in the system

red ledge
#

true

#

would a normal http post work?

#

or is it better to have a socket connection

thin stratus
#

That depends on your system.

#

Idk how the rest is setup

#

But tbh I doubt you'd use Sockets for that

#

MasterServer can def not keep them all up

#

Or maybe, but doubt

red ledge
#

it's just a simple http python server

thin stratus
#

Yeah then a POST is probably enough :P

red ledge
#

I will look into just sending regular pings

#

if they can show the port

#

might work

#

but thanks!

thin stratus
#

No biggie.

#

Other question: Has someone send FQuat over an RPC?
Got ControlRotation in form of an FQuat and wondering how to make this less bandwidth heavy to send

#

I know it's implementing NetSerialize by default

#

Hm, seems like Epic is packing Roll into a Byte and Pitch and Yaw into an uint32

#

I don't see them doing the same for the client though, so I guess the Server has less accurate values for the control rotation of the client

grand kestrel
#

Why are you trying to send an FQuat over an RPC πŸ€”

#

Most of control rotation is already sent

thin stratus
#

Cause this is not using the CMC

#

Neither is it using FRotators

grand kestrel
#

Have a look at APawn::GetBaseAimRotation

#

You can just convert to rotator and do the other axis that you need the same way they do RemoteViewPitch

#
    UPROPERTY(replicated)
    uint8 RemoteViewPitch;```
thin stratus
#

I'm not using any Rotators atm

#

If at all I would do Quat->Rotator->RPC->Quat

#

To do the same packing Epic does

grand kestrel
#

Why can't you convert to/from

thin stratus
#

This is also not build up on the ControlRotation of the Controller

#

Well, I could hack it in there

#

But all I actually need is to send the Quat via ServerMove

#

And that as bandwidth friendly as possible

#

I'm just confused that the CMC makes sure Input Acceleration is rounded for the client too

#

But ControlRotation stays untouched for the client, yet rounded for the server

grand kestrel
#

I think the corrections regarding acceleration are a lot more impactful

#

So they want it to line up as much as possible

thin stratus
#

That's fair, I would need rotation to be the same too though, as the pawn can rotate freely

grand kestrel
#

Don't quote me on that

#

Just a guess

thin stratus
#

Also RemoteViewPitch is really just the ControlRotationPitch replicated extra from Server to Clients.

grand kestrel
#

Indeed

thin stratus
#

That's a later step

#

Right now I need the Server to get the same ControlRotationQuaternion that the client uses

#

I guess for now I can just send the pure Quat

grand kestrel
#

Why not use net profiler

thin stratus
#

And check later how to optimize it

grand kestrel
#

And compare

#

Send the same RPC, one with rotator, one quat

#

At same time

#

See what they both consume

thin stratus
#

Yeah, Rotator vs Quat isn't even the issue

#

I can convert the Quat to Rotator

grand kestrel
#

Then you can decide on your bandwidth budget for the movement and if its a good use of resources

thin stratus
#

And pack it the same way Epic does for the normal rotator

#

But I'm afraid the packing, since I'm actively using the Quat for movement, results in different rotations for client and server

#

Even though I'm not sure if

grand kestrel
#

Hmm

thin stratus
#

Quat->Rotator->Quat

#

Results in the Quat remaining the exact same data

grand kestrel
#

Thats what I was about to say

#

It might be guessing the axis

thin stratus
#

I mean, Rotator is 3 floats

#

Quat is 4

#

One float more to replicate is nothing bad

grand kestrel
#

Yeah, and you can achieve a rotation direction the same way with different axis

thin stratus
#

Just would need to pack them all 4

grand kestrel
#

I think if its such a critical component of your game and you can't be certain they'll be consistent then you might as well

thin stratus
#

Might as well send it fully and care later haha

#

"My game is laggy"

#

"DEAL WITH IT CARL!"

grand kestrel
#

Yeah, guess it could fall under premature optimization

thin stratus
#

Can't be too careful with fast paced movement replication

grand kestrel
#

Indeed!

#

I'm doing shooting replication, its basically absurd

#

Full prediction and rewind for projectiles

#

With large player count 🀦

#

Almost finished only took ~6 months

thin stratus
#

Disgusting

#

Our shooting system is 90% projectile based

#

With bouncing

#

The only optimization I did so far was tracing for close combat and just doing a linetrace instead of spawning the projectile if it's too close

#

Not looking forward to further optimize that

grand kestrel
#

The projectiles bounce or the players πŸ€”

thin stratus
#

Projectiles

grand kestrel
#

Ah, ours does... everything you can imagine

thin stratus
#

Despite the Rockets

#

Well we have hovering drones

#

That shoot fast projectiles that can bounce

#

I will just leave it like that until someone starts crying about it

grand kestrel
#

We can ricochet 71500cm/s 1200RPM full auto rifles using projectiles (not hitscan) with ours πŸ˜›

#

Its highly highly optimized

thin stratus
#

Ha, before that would happen I would talk my client out of it

grand kestrel
#

Hindsight.

thin stratus
#

Hm, why would the save Start and End ControlRotation

#

What could happen between start and end of a move that would change the controlRotation so that it matters for replaying?

grand kestrel
#

Only thing I can think of is corrections

slim holly
#

anyone got any idea how to assign input devices to each player in splitscreen?

#

as in context: "Press X to join" to add another player in lobby

grand kestrel
#

I think thats the wrong kind of multiplayer for this channel πŸ˜„

#

(Maybe)

slim holly
#

local multiplayer is still multiplayer. Granted, this channel is mostly online talk

grand kestrel
#

Oh I wasn't saying you shouldn't ask here, just that the people who do those games tend to be single player and would be less likely to be in here 🀷

thin stratus
#

Should the Screen be splitted when you press X? @slim holly

#

The main issue that I encountered with "Press X to join." is that you need a PlayerController to receive input.

#

And for that you need to call CreatePlayer

#

And that causes the GameViewport to render the splitted screen.

slim holly
#

ye I can do that, but I wanted to see if I could use one controller for 2 players

#

since I lack the need for keybinds

grand kestrel
#

I feel like PlayerStart is trolling me when it pops up and I want a PlayerState

thin stratus
#

Idk

slim holly
#

and or, determine does player 1 use keyboard or controller

#

that's another issue

#

project settings has checkbox for assigning controller to player 0

#

but how do I do it during runtime

#

or do I have to go around McGyver style and just add 5 players by default, kick the ones that aren't being used

thin stratus
#

Splitscreen is limited to 4

slim holly
#

yes, I was thinking removing player 0(keyboard) and just keep 1-4(controllers)

thin stratus
#

Let me correct that

#

You are limited to 0-3

#

As index

#

So 1-4 Players, that are mapped to 0-3

slim holly
#

ofc it can't be the easy way

thin stratus
#

One Controller for two players doesn't sound like splitscreen though?

#

Are you just trying to control two characters with one controller?

slim holly
#

like, Brothers

thin stratus
#

Like Brothers,?

#

Ah

#

Yeah that has nothing to do with Splitscreen though

#

Just implement the controls in the PlayerController

#

Send one event to PawnA

#

And the other to PawnB

slim holly
#

my project is a slot car racing game, only needs 1 button

#

but like, I was hoping to do this without one-player-controller-two-pawns hack

#
  • doing a camera split for one controller is major performance issue
thin stratus
#

Right the other hting would be using two player controllers

#

But then you need to, as you mentioned, somehow route the input through both controllers

#

I'm pretty sure if you follow the boolean you mentioned that sits in the settings

#

Through the Source of UE4

#

you might find where it's used

#

And then find out what to do to have one controller affect two controllers

slim holly
#

any idea who handles IInputDevice

thin stratus
#

Nope

slim holly
#

ULocalPlayer seems like a start πŸ€”

#

ULocalPlayer::SetControllerId

#

no that's not it

#

terminology is not helping here πŸ˜…

thin stratus
#

I wonder, wouldn't it be safer to send the Control Input Event instead of the Rotation directly?

#

I feel like sending the rotation directly is basically asking for an aimbot?

bitter oriole
#

Doesn't have to be really

#

You can check for the rotation delta in Validate

#

Plus frankly, aimbots aren't really preventable with tech on PC

thin stratus
#

Fair enough I guess. Currently trying to figure out how to make ReverseControls a thing.

#

We have an ability that inverts your inputs for a specific amount of time

bitter oriole
#

The CS scene has moved to triggers that "just" fire on aiming a player, which is much stealthier, funnier to play, and almost as efficient if you're any good

thin stratus
#

However in the original offline build, this was handled before sending the input over to the server

#

I would need to do that on the server side, but the rotation isn't an input as just mentioned

#

I could invert the InputAcceleration that the client sent

scenic raven
#

How would you go about replicating AIControllers?

thin stratus
#

But the rotation is already a fixed rotation, not an input

scenic raven
#

I could change the properties on the BP subclass of my AIController but I would like to replicate the CPP one.

#

nevermind, found it thx πŸ˜ƒ

slim holly
#

I don't think you can send the input only

#

since delta time between input and updates are different

#

you would have to accumulate the local input into pool and sign the packet to make sure server knows it's getting everything, but it would still desync over rounding errors

#

I would think "encrypting" input into a string library using random seed would put a major bump in the road to make aimbots

bitter oriole
#

People will just script mouse movement

slim holly
#

ye it wont stop them, but makes it less reliable than reading/writing the value directly in memory

bitter oriole
#

There's no point doing that stuff. For aimbots, you need some sanity checks on server, a reliable way to ban people, and a report system

#

People will always find a way around tech on PC

slim holly
#

most reliable way is to add human factor to it

bitter oriole
#

It's the only way

#

Welcome to competitive games on PC

#

There's no trust built into the platform so you have to accept that people will play your game through Wine with a custom kernel and none of your software has authority to do anything real

slim holly
#

Overwatch did something, most aimbots fell back on shape detection there

#

which means they couldn't read the memory

bitter oriole
#

You don't need to read memory lmao

slim holly
#

too bad every enemy had red outline to make it easy

bitter oriole
#

You can build a fairly reliable aimbot by getting the video, building movement vectors over each frame to detect stuff moving vs its background, and clicking mouse if that object is covered by the center of screen

#

Works in pretty much any game, doesn't need any interaction with the process

#

Triggerbots aren't trivially detectable by even humans if the cheater isn't being stupid

#

It's important to spend time on making sure players can report cheaters to get them banned, and spend time logging every input on every game server to add checks in your game

slim holly
#

you can detect it mathematically, but not with naked eye

bitter oriole
#

You can't detect triggerbots mathematically, no

#

That's the point

slim holly
#

linetrace and measure time over enemy and compare it to fire event frequency, Im sure it would look very different if you compare human and machine

#

like button held down time

bitter oriole
#

The only thing a triggerbot does is pressing the mouse button at the right time, which happens to be what pro players do

thin stratus
#

Yeah you'd basically ban Shroud instantly haha

bitter oriole
#

Valve has been having great success with machine learning because they had a reliable loop of millions of reports -> thousands of bans -> lots of data over year

#

Players look at video, tell machine learning that it was or not a cheater

#

machine learning now submit video

#

Players confirm or infirm

#

etc

#

There's no algorithm though

#

Every ban is player-decided

thin stratus
#
else if (PawnOwner->GetRemoteRole() == ROLE_AutonomousProxy)
{
    SmoothClientPosition(DeltaTime);
}

Shouldn't this smoothing the movement of the Client being visible on the Server?

#

Cause I know that the CMC isn't properly smoothing clients on the listenServer

#

Now I wonder if the function is broken or if that's not the function I'm looking at

#
// Smooth on listen server for local view of remote clients. We may receive updates at a rate different than our own tick rate.
if (CharacterMovementCVars::NetEnableListenServerSmoothing && !bNetworkSmoothingComplete && IsNetMode(NM_ListenServer))
{
    SmoothClientPosition(DeltaTime);
}
#

That's the comment in the CMC

#

@chrome bay Whenever you have time, could you give me a quick suggestion on smoothing the client on the ListenServer?
Cause even with the above code, the Client looks laggy on the server

#

it's basically the CMC code

#

Aaaactually

#

The SmoothingMode was linear

#

Exponential looks fine i guess?

#

I wonder though why the Client can see the server move, even though I'm not simulating the clients yet

slim holly
#

plowing through souce is getting me nowhere

#

ok found lots of uncommented code, I could be close

slim holly
#

alltho, AutoReceiveInput player list goes from 0 to 7

#

so 8 local player is maxium πŸ€”

thin stratus
#

I said Splitscreen is limited to 4 players

#

I think that was before we swapped the base of the discussion to something like Brothers :P

scenic raven
#

@winged badger following your suggestions, I refactored everything, in order to replicate AIController and have a clean chain of ownership Character<-AIController<-PlayerController. Thx a lot for that. Unfortunately the role for character is still SimulatedProxy rather than AutonomousProxy. Any tips on how to fix that?

winged badger
#

i never did need to, but you should be able to set the Role manually

thin stratus
#

AActor::PostNetReceiveLocationAndRotation
AHA. That sneaky bastard causes my client to see the server moving even without simulating it

winged badger
#

@scenic raven could be as simple as setting RemoteRole server side and Role client side to AutonomousProxy

scenic raven
#

@winged badger I wonder if by changing it manually something will break

winged badger
#

i did see some functions that copies roles... somewhere

#

probably GameMode

#

but i don't remember much about it

#
void AActor::CopyRemoteRoleFrom(const AActor* CopyFromActor)
{
    RemoteRole = CopyFromActor->GetRemoteRole();
    if (RemoteRole != ROLE_None)
    {
        GetWorld()->AddNetworkActor(this);
    }
}
#

will probably do the trick

slim holly
#

right, since I can't assign devices to controllers, I just gotta add all possible local players and only spawn pawns for the ones that have confirmed to join the game

#

this prevents me from using the built-in splitscreen rendering tho, so I gotta figure that one

thin stratus
#

You can override the GameViewportClient class

#

It handles how the Splitscreen is created

#

Even the sizing

#

I creates one per Player

#

I added a check for "Player->bWantsToPlay"

#

You do have to clean the players who don't want to play up though

#

Otherwise, if you have an automatic spawnsystem from the GameMode

#

They will travel to the new level and spawn there

thin stratus
#

Alrighty. 90% of the hovermovement seems to work (I will never do something like this ever again!). Now one thing missing is when two of the pawns collide

#

Applying an Impulse on Hit is def not a good idea :D

#
    /** Rotates controller ids among gameplayers, useful for testing splitscreen with only one controller. */
    UFUNCTION(exec)
    virtual void SSSwapControllers();```
#

Things you randomly find

slim holly
#

even if I could overwrite the GameViewPortClient, having splitscreen enabled stops you at 4

#

which would mean player 0 is forced to use keyboard as input

thin stratus
#

Player 0 is never forced to use the keyboard

#

Our game also allows 4 players to play with 4 gamepads

slim holly
#

only if you use "Skip Assigning Gamepad to Player 1"

thin stratus
#

Rather only if you don't use that

#

That just means that the gamepad is assigned to player two

#

So that you can test with only one gamepad

#

If you don't tick that, player one has the gamepad (and the keyboard)

slim holly
#

also getting alarming amount of 404's when trying to google this stuff

#

okay I think I get it

#

input device is tied to controller ID, and controller 0 doesn't have to exist

#

viewport defaults to lowest index

orchid belfry
#

Hello there, I'm in a bit of a pickle there. Me and my team are making an RTS using UE4, and we're having an issue regarding possesion of a pawn by an AIController on a client. We need to have the pawn actually possessed (we use a custom lockstep network engine, and made all behaviors deterministic), so that it moves, attacks and does stuff. What solutions do we have, besides going inside the engine, and enabling possession when you aren't a server ?

sick edge
#

Hi,
Does anyone have any beginner's documents for Android connection to a server?
I need my app to connect to a server where data is stored for mostly reading and authentification. I have strictly NO idea on how it works, neither have I done this on a computer before. I need this for work though and I would be glad if anyone had a step-by-step list of documents for me, from how to setup a server for this kind of application, to how to actually communicate with it from an Android app.
(actually, I have done this before but in Java, for computer apps, with a team that knew better than me how to setup everything, and I was just making SQL requests ^^)
Thanks in advance for any help!

(I also posted this on #mobile but I think I can learn a lot from this chan too ^^)

keen thorn
#

anyone recommend a good multiplayer backend like playfa ?

#

playfab

#

i need an easy one to use for server listen, joining and hosting. friendlist etc

#

server listing

gusty slate
#

@orchid belfry What issues are you having? Pawns should be spawned by the server, apart from that, make sure the AI possession in the pawn is set to Placed in World or Spawned and I believe it should work

thick shale
#

Does anyone have any advice for predicting movements applied to other players?
I'm trying to work on hit reactions where one player can hit another player and push them back with a hit.
Prediction works fine for the local player's movement component, but when hitting other players it seems like the moves sent up via the movement component aren't used

keen thorn
#

@thick shale movement component is a bit bugged if u dont use it the way its meant to

#

@thick shale not sure how u apply hit reaction

#

@thick shale but lets say u set velocity or add a small force, the server and client will actually desync for small amount of force/velocity, like a value of 20, and it also depends on fps

thick shale
#

I'm playing a montage, and sending a saved move to the move comp. the move consists of a FRootMotionSource_ConstantForce

orchid belfry
#

@gusty slate the problem is everyone handles spawning, in fact the lockstep ensures everyone gets order at the same time, and via the deterministic nature of the game, everything happens the same without having to transfer more than X is going to move to there. Therefore we need client to spawn pawns with their own ai controller so that they can receive and interpret the order

thick shale
#

I saw that it was supported in the movement comp, tried it and it worked, but it seems like it only really works for Autonomous Proxies

#

Simulated Proxies don't seem to care

keen thorn
#

@thick shale im not sure in ur case, but i had issue with applying force to movement component of characters, had to resolve to add vector input

#

the only way that seem to work

gusty slate
#

@orchid belfry Hmm I am still new to UE's multiplayer, and seeing that you have a highly custom setup, I honestly don't know then πŸ˜ƒ But I know for certain that spawning pawns in client (for example Controllers) just spawns them for the client

#

they do get spawned, but no replication and no AI possession really.

#

That's as far as I can help you πŸ‘

thick shale
#

@keen thorn so the idea is to maybe replace the rootmotion with AddInputVector?

keen thorn
#

@thick shale not sure man cus addinputvector does not calculate the root motion right

#

maybe someone else can help with multiplayer root motion

thick shale
#

I'll give it a shot, seems like if I can crack this, everything else will kinda fall into place

keen thorn
#

ye

thick shale
#

thanks

gusty slate
#

Question, let's say that I have an actor A that has a variable X. If I want for example the gamemode (server) to set X while X is only relevant to A (OwningClient) do I still need to make X set to Replicated?

#

Like for example if I want to give each Player controller a Team ID on PostLogin, does the TeamID variable inside the player controller have to be set to Replicated? Or is there some way to modify a variable in server and owning client?

thin stratus
#

If you want the client to get that id

#

It has to be set to replicate

gusty slate
#

I see. I'm using Tick and the debug filters on breakpoints to check and it indeed seems that way.
Btw, Cedric, good job on the compendium πŸ˜ƒ Myself being someone that has experience with UE but not its multiplayer side, it's a great resource πŸ‘

thin stratus
#

Thanks, glad it helps (:

winged badger
#

and if you want TeamID, it fits far better into the PlayerState

#

then in PC

gusty slate
#

do you have examples on data that suits one and the other?

#

Just so I can have some reference moving forward

winged badger
#

PlayerState is meant to hold the publicly accessible data about players

#

its replicated by default, and everyone has everyone else's PS

#

TeamID is just something that fits into that category

#

and as its readily accessible from PlayerPawns/Characters

gusty slate
#

I see, makes sense

winged badger
#

you can easily wire up something like visual cues for friendlies/enemies that way

scenic raven
#

I am trying to replicate an AIController. I set bReplicates to true

#

but it doesn't replicate

winged badger
#

its also bOnlyRelevantToOwner by default

scenic raven
#

yep

gusty slate
#

@winged badger Thank you πŸ˜ƒ

winged badger
#

there isn't much more to it, i keep mine Replicated and AlwaysRelevant, as my game structure needs the information in AIControllers to simulate Characters you don't own

scenic raven
#

Recompliling made it work

#

god bless live reload

#

😦

winged badger
#

there is also the distance based NetRelevancy involved, as AIControllers are not guaratneed to follow your Characters around if you don't attach them

#

so they might end up going out of 15000 UU range

#

and yeah, never hot reload πŸ˜„

scenic raven
#

so I am hitting another interesting problem. The moment I change my character from SimulatedProxy to AutonomousProxy

#

it doesn't move anymore

winged badger
#

did you also change the RemoteRole on server?

scenic raven
#

if I untick run dedicated server on editor it does

winged badger
#

basically, just setting the Role locally should be enough to pass that GAS integrated check

#

and MoveTo server side shouldn't be affected by it at all

scenic raven
#

I see

#

isn't that a little hacky? Making the server think it's simulatedproxy while it's autonomous?

winged badger
#

happier solution would be to override the GAS check

scenic raven
#

I have already done that in another branch

#

and it wors

#

It works

#

I wanted to explore a solution where I don't touch Epic code

#

but I fear that's the cleanest solution.

winged badger
#

i have no idea what functions are virtual there

scenic raven
#

none. You have to go and fork the plugin.

#

it does work it's not that bad

#

but still

#

also I believe that check is totally bogus and shouldn't be there

#

internaltryactivateability does much better checks

#

tryactivateability does that random not simulatedproxycheck for no reason

#

btw why doesn't the server want to move it properly when role is Autonomousproxy?

winged badger
#

that would require digging into the AIMoveTasks

#

i don't require my AIController character to be AutonomousProxy, so i never ran into that problem

clear copper
#

Can I send something from my GameMode to the GameState so other players can see it? I have the GameMode tracking number of players using OnPostLogin, and I want my players to have a player list on their UI, but since clients don’t get the GameMode class I am thinking of sending it to the GameState

#

That should work right?

winged badger
#

GameState has a PlayerArray variable

#

which is an array of PlayerStates, one per player

#

it would work @clear copper , but you already have built in solution

clear copper
#

Oh damn

#

Lol

winged badger
#

also, PostLogin option would fail in case of SeamlessTravel, as Login functions are not called then

maiden vine
#

how do I use 2 players option to get the 2nd viewport to have a pawn too like in the thirdperson template I cannot get mine to work the same way. It wont possess on 2nd screen? thx

clear copper
#

@winged badger so do you use the GameState to check that the number of players in game is equal to the number of expected players after seamless travel?

high current
#

Hey, I need to make a ready system for a multiplayer lobby, once everyone has connected to a match, how would I approach this, I am currently trying to utilize the get player array on game state, and then have a variable in player state, but I am having trouble replicating the value from client to other clients

#

or should I use events to send data to server?

thin stratus
#

Well I assume a player presses ready?

clear copper
#

Blueprint Runtime Error: "Accessed None trying to read property PlayerState". Blueprint: PC_Campaign Function: Execute Ubergraph PC Campaign Graph: EventGraph Node: Set PlayerName

high current
#

@thin stratus yes

#

I got it to work via, the following BTNpress in UMG>RunOnServer event that sets a bool ready in PlayerState. That event also calls an event in GameMode, which scrolls trough all player states and checks if the ready bools that are true equal the num of player states, and if that turns out to be true, then game mode casts to all pawns possessed by a controller, and runs an event on the owning client, which event casts to the UMG hud, starting a timer, and if the timer is finished, then spawns all players with the selected character n positions ( i have a character selection which has its own dummy pawn and hud)

#

So it works, but I think its kind of messy

dark sandal
#

I wanna do mp in ue4 but dont want to use the steam subsystem

#

any ideas?

robust wind
#

There are some ways you could deal with it either use the build in online subsystem works with LAN and connection over IP directly to each other another way would be something like spatialos where you have dedicated servers you can join on but relys on what type of multiplayer game you wanna do another option would be to create your own online subssystem but I assume that isn't an option for you

#

But why wouldn't you use steam?

#

@dark sandal

dark sandal
#

well i have a huge problem. i dont want to publish onto steam

#

and if i use steam it gathers a bunch of other games that have nothing to do with my game

bold hatch
#

^ Cause of steam

#

anyone release on Epics launcher?

gleaming vector
#

anyone try to use a FastArraySerializer array inside of a struct that is serialized with NetSerialize?

#

it wont serialize the array

#

and I think i'm doing something wrong since im not calling DeltaSerialize

gleaming vector
#

i have solved the issue without using a fast array serializer

grand kestrel
#

I have UtcNow replicating server -> client, this is an FDateTime. I wonder if theres a way I can have a local FDateTime that will not allow itself to be set by another other than the OnRep

#

Just to make it harder for hackers

#

Because I don't want to replicate it regularly

#

Actually I guess it doesn't matter

#

Its not like the client will ever do anything meaningful with it

real yacht
#
  1. my server (gameMode) spawn power up
#
  1. power up is picked up on server (rpc) and start ticking (have some logic) on server
#

i want to update players UI for example power up duration, best way to do this? do you think that i can store picked up in player state

#

so i can get some var from power up and display on UI

winged badger
#

@clear copper GameMode has NumTravellingPlayers, so you can easily find out how many are in transit

#

@grand kestrel you can't do anything to prevent applications like CheatEngine from directly modifying a value in a memory address

#

if you feel really strongly about it though, you can hash the variable, then before its assigned a new value check if the hash is still good

grand kestrel
#

Yeah figured, I'll just not rely on it ever being accurate on clients (true for everything), I had tunnel vision at the time πŸ˜›

real yacht
#

anyone? πŸ˜„

winged badger
#

there is no best way, depends on the rest of the code

#

PlayerState works for this, if you want to head that way

real yacht
#

so when game mode spawn actor he is owner, right?

winged badger
#

not quite, owner will be null by default, unless you set it in FActorSpawnParameters

#

and if you do then whatever you set as the owner is the owner

real yacht
#

i'm updating turret rotation like this

#

and this works

#

but when i set repNotify and update rotation of object, that doesnt work, why?

#

how can i optimize without calling rpc, just with rotation var

meager spade
#

you have to send to the server

#

server is the only one who can replicate a variable

#

so locally set, it will never replicate

winged badger
#

and never, ever replicate the variable back to owning client when you do this

#

SkipOwner

thin stratus
#

Turret Location, just with the given Context, looks like something entirely done on the Server

#

I can't see why the Rotation would come from a Client, if not Client Controlled

winged badger
#

i don't see why a server RPC if its done server-side

thin stratus
#

Na, I mean that it shouldn't need one in the first place

#

If this is just a Turret that should share rotation with Clients, it would all be done on the Server in the first place

real yacht
#

well im rotating object locally, than RPC server

meager spade
#

yeah if its server only, but hey this could be on the client? who knows, two nodes don't really explain the whole situation

thin stratus
#

Yeah we would need more info of what @real yacht is even doing there

#

The nodes like this could funnily enough be bough situations

#

And just lacking knowledge

winged badger
#

the object that contains that logic has to be owned by a local PlayerController

real yacht
winged badger
#

for it to work

meager spade
#

yeah it might not have an owning connection like zlo said

thin stratus
#

Right, the RPC is then 100% needed

#

An OnRep alone won't do it

#

cause yo uare on the Client

real yacht
#

yep

thin stratus
#

(to answer that initial question)

#

So you can totally set the Var to OnRep

#

And maybe add the condition to skip owner

#

And then set it inside the ServerRPC

#

Small note: If this is executed on Tick, please don't set the RPC to reliable

real yacht
#

reliable disabled

meager spade
#

yeah it doesnt matter if the rotation skips a few frames, reliable every tick will just eat your RPC bandwidth and not allow other RPC's through

#

a smart way would be to scope the replication, and simulate on other clients

#

between updates

winged badger
#

and definitely SkipOwner for replication, or you will have some jitter there

meager spade
#

but that is not something easy in Blueprints πŸ˜„

real yacht
#

i will do some network profile before and after

#

i will post here

halcyon abyss
#

hey guys, just a very quick question
If two players in split screen join a match online...
What info does the server have to determine they belong to the same client?

astral gust
real yacht
#

is it heavy if i have actor that is replicated

#

and that actor have some mesh, partice system, materials, etc..

bitter oriole
#

Not particularly no

real yacht
#

i have my game mode that spawning pickups, they are not replicated, so after that i'm spawning "cosmetics" pickups on clients

#

is this properly to do, or just set replicated on actor, and it will be spawned on clients also

bitter oriole
#

I would just set up a replicated actor

real yacht
#

okay, thnx

clear copper
#

@winged badger yeah but how does that help me? I’m trying to get the clients player name from their player state so I can display it

winged badger
#

the last question was hardly related to that

#

with seamless travel, playerstates will persist through the level transition

thin stratus
#

It also kinda depends on when you are calling this

#

Which BeginPlay is that?

#

Random arse actor can have BeginPlay being called before the PlayerState is set

#

For all we know at least

winged badger
#

depends what you do in GameMode @thin stratus

thin stratus
#

Either you poll the name (mΓ€h) or you let the PlayerState say "Hey I'm here, get the name."

#

Yeah SeamlessTravel is a thing for itself

winged badger
#

in general, PS will be instantiated before the PlayerPawn

#

by default, clients will have a valid PlayerState on Pawns on BeginPlay

#

server will not

thin stratus
#

The image suggests

winged badger
#

unless you deferr spawning the PlayerPawn, and set the PlayerState and/or Possess it before you FinishSpawning, on server BeginPlay will be called on PlayerPawn before it has a controller or pawn

thin stratus
#

He's using it where the PlayerState variable exists

#

So if this is in the Pawn

#

BeginPlay is wrong

#

Cause the Pawn is not possessed on BeginPlay

#

Without being possessed -> no PlayerState

#

OnPossessed in BPs

#

Or just the OnRepPlayerState in C++

#

Would be a better place

winged badger
#

on clients, PS and Controller variables are received via replication, and when instantiating network Actor on clients, BeginPlay is postponed till after PostNetInit

thin stratus
#

Correct, but Spawning a replicating Pawn will cause BeginPlay to call

#

And you usually possess it afterwards

winged badger
#

unless you deferr spawning

thin stratus
#

Which is not a BP thing

winged badger
#

true

thin stratus
#

If you are in C++ you can just use the OnRep of the PlayerState

#

No need to deferr

#

It's already existing in pawns anyway

winged badger
#

having said all that, Pawns have default NetPriority of 3, and PS has NetPriority 1

#

so unless you change that, odds of PS replicating over before PlayerPawn are zero

#

which means PlayerPawn won't have valid PS on client on BeginPlay

#

so, as far as i know, PS with NetPriority of 4+ will be available on clients on BeginPlay

clear copper
#

Ah

#

Well shit lol

#

So having it on begin play of my player controller could be the issue

thin stratus
#

BeginPlay of PC could work, but might suffer from the same replication race condition problem as the pawn

clear copper
#

Yeah it’s currently on my PC

#

And it only works about 30% of the time

thin stratus
#

Just do it other way round

#

In PlayerState

#

On BeginPlay

#

"GetOwner"

#

If valid

#

Cast to PC

#

And set the Name

clear copper
#

Yeah I was thinking that

#

But will the if valid always return true?

winged badger
#

its not technically a race condition

#

BlueprintImplementableEvent calls are asynchronous, and pretty slow

#

so sometimes they are slow enough for PS to replicate over

clear copper
#

Yeh I think I have too many dependent things on begin play, because this has happened elsewhere. I might give them all a custom function and then call that function from GameMode after everything has been loaded?

thin stratus
#

so sometimes they are slow enough for PS to replicate over
If it's sometimes slower, then "Race Condition" fits quite well. :P

chrome bay
#

BlueprintImplementableEvent calls are asynchronous, and pretty slow

#

wait wut

winged badger
#

its not a network race condition

chrome bay
#

I guess we're talking about network BP events here

winged badger
#

@chrome bay teleport a camera to Pawn via BlueprintImplementableEvent, then teleport the Pawn in c++

clear copper
#

@winged badger is there a function that is called when everything has finished being created and possessed etc

winged badger
#

see what happens

chrome bay
#

If I call a BP implementable event from C++ the event fires right away

winged badger
#

but the following line in c++ doesn't wait for it to execute

#

the BP logic

chrome bay
#

I'm fairly sure it does, everythings running on the game thread

thin stratus
#

Well, put a breakpoint at the end of a longer taking BP function.
And one behind the event in C++

#

See which one executes first

#

Pretty sure the BP one does

chrome bay
#

You would think so, I mean unless breakpoints are done differently because of the VM

thin stratus
#

Gnah

#

You know what I mean

chrome bay
#

Yeah for sure

#

I mean I have a lot of code that's dependant on BP events running their code before C++ continues

winged badger
#

i recently made an error in my revive... i first teleported the camera to Pawn via BPImplementable, spawned some ParticleEffects in c++, and then teleported the Pawn, also in c++

#

guess what was the result 90% of the time?

#

camera was locked on Pawns new position, after teleport

chrome bay
#

There might be something else going on there though. If I have a bool that's accessible in C++ but can be Set from BP, and from C++ I call a BP-implementable event that sets it to 'true', I would fully expect the bool to be true when I access it in C++ immediately afterwards

thin stratus
#

It has to be cause I'm using these Events to get stuff from my BP

#

Like a BP assigned MeshComponent

chrome bay
#

Yeah same here

winged badger
#

mine had a void return

thin stratus
#

In the case of PC and PS. I'm more sure this is due to the PC being spawned and then PC spawning the PS.
In the time that the PS gets Spawned and Replicated, the PC is already replicated to the Client, calling BeginPlay.

chrome bay
#

I don't see why return type would change the way it's called either way, but yeah. Easy thing to test

winged badger
#

its also the PS NetPriority being pretty low

thin stratus
#

Sure, but in Theory, if both would have the same priority, the PC got spawned first.

#

So you can't bet on the PS being available

#

That's what OnRep is for after all

chrome bay
#

tbh just approach any multiplayer code situation as if nothing is available ever

winged badger
#

PC has to spawn first for DataChannel to work, iirc

chrome bay
#

(I use delegates quite often)

thin stratus
#

TICK POLL EVERYTHING

chrome bay
#

all joking aside, I have always done ticking/polling for UI

thin stratus
#

Oh my UI is binding

#

I can't be arsed to do this event based

chrome bay
#

Far too much of a pain in the arse to do it otherwise

#

I'm not using bindings cus they're evil but, similar thing

clear copper
#

Jesus I’m lost now. Lol. I have a lot of reading to do

chrome bay
#

yeah going off topic now πŸ˜„

winged badger
#

not to mention that a widget with 10-15 UMG function bindings can readily eat 1ms

chrome bay
#

Yeah I'm not a fan.. it's a good system from a usability standpoint but urgh

winged badger
#

its good for fast prototype

chrome bay
#

yeah for sure

thin stratus
#

Well, until the few Name and ProgressBar bindings are taking more than the bad optimized meshes in our scene

#

I will keep it that way

chrome bay
#

hey if it runs at 60fps who cares πŸ˜„

#

runs away

thin stratus
#

It doesn't in splitscreen

#

BUT, GPU ms is higher than Game ms

#

so not my problem

chrome bay
#

I say all this, but I always lean towards premature optimization and never get anything done

thin stratus
#

runs away too

winged badger
#

i don't, my prototype UI usually takes between 5-7ms

chrome bay
#

that's why I've been messing about with hovertanks for like 5 years

winged badger
#

then it gets rewritten

#

oh, and disclaimer for the BPImplementable part before: only testing i've done was with Editor, never know when that matters with Unreal

supple vapor
#

anyone know how to replicate 'setSkeletalMesh' node?

#

i've set my mesh component as replicate and run the node in 'run on server reliable' event but it only gets set on server

#

never replicates back to client

#

doing 'multicast' sets it on server and owning client but not on other clients

winged badger
#

you need to replicate a SkeletalMesh variable, with OnRep, then set its value on server, and then inside OnRep do the SetSkeletalMesh

supple vapor
#

@winged badger thanks appreciate the reply, i did that with OnRepNotify() but it only works for server and owning client

#

other clients still see the old skeletal mesh

#

any idea why?

grand kestrel
#

Is this an engine bug..

  1. Create a replicated actor
  2. Add a skeletal mesh componentA, make it root
  3. Add a skeletal mesh componentB under A
  4. Hit play and get a stack overflow in AActor::IsNetRelevantFor() because of this line
    else if ( RootComponent && RootComponent->GetAttachParent() && RootComponent->GetAttachParent()->GetOwner() && (Cast<USkeletalMeshComponent>(RootComponent->GetAttachParent()) || (RootComponent->GetAttachParent()->GetOwner() == Owner)) )
    {
        return RootComponent->GetAttachParent()->GetOwner()->IsNetRelevantFor(RealViewer, ViewTarget, SrcLocation);
    }```
Which effectively does: ***A***->***B***->GetOwner() (<< this is the owner!)-> and so forth
#

It never considers that the attach parent could be within its own actor

#

Gonna see if later engine releases fix it

#

Nup.

chrome bay
#

That's weird. So the two skele-meshes are inside the actor, and one is the root?

#

Nothing seems off about that...

grand kestrel
#

Hmm I did it in a minimal example and no issue

#

Gotta figure out what on earth is causing my stuff to trigger that

grand kestrel
#

@chrome bay My theory is that when I SetRootComponent() its not reordering the components so its not checking the root component first

#

Need to find out where IsNetRelevantFor decides to test the child mesh first..

#

The problem is that RootComponent->GetAttachParent() is returning a component within the same actor

#

Whereas if it was actually testing the root component, that wouldn't happen

#

It would be null unless attached to a different actor

rain coral
#

Any ideas why the Get User Widget Object would be null on clients that are not locally controlled? They receive a name fine, but trying to show it on a world space widget which is null.

grand kestrel
#

@chrome bay Found it. Had to call DetachFromComponent() after setting it as root 😐

chrome bay
#

haha

naive shell
#

In my game instance i have a event that adds the widget to the viewport and show mouse cursor, im using get player controller. And then it shows this error

#

That event is fired in the map bp when begin play

thin stratus
#

How about putting the Widget Creation into the PlayerController (:

#

Instead of putting in into 3 different classes

#

Where two of them have nothing even remotely to do with your UI

halcyon cradle
#

Hello, iam trying to create an app where the server player moves around and all the clients move like the server does

#

can i do this without having a pawn of each player on scene ? only the current player pawn ?

main sentinel
#

Hello there!

How do I ServerTravel on a dedicated server? I managed to make it work on a listen server but it doesn't work with dedicated servers.

finite willow
#

Hey guys. I am fairly new to Multiplayer inside Unreal Engine and encountered a problem which took me a while to find the cause of it. When the player hits another player with a melee attack I do a trace. On the client everything works fine. However I figured that the server is only registering the hit event when it actually has the client performing the melee attack in the viewport. Any attacks from clients outside the servers "Viewport" are not registered. Can anyone help me with that?

grand kestrel
#

🀦 🀦 🀦 nvidia why does simulated latency with clumsy affect your shadowplay overlay πŸ€”

#

πŸ₯‰

slender yarrow
#

If you call an event that executes on client from an event that executes on the server is that code after the client event technically being run on the server? The server is telling the client to run that code. Im having like a brain aneurism trying to visualize this πŸ€•

grand kestrel
#

Client sends server rpc -> server sends client rpc is pretty normal

#

The client could ask for some info and the server responds

#

is that code after the client event technically being run on the server? No its running on the client

slender yarrow
#

i didnt mean literally

#

im talking from the anti-cheating standpoint

grand kestrel
#

Its not technically running on the server either

slender yarrow
#

when people say "oh the client shouldnt ben in control of this"

#

If you told the client to do something from the server is it clear in that sense. Cause it wasnt ran directly from the client

grand kestrel
#

The client can still override the behaviour, yes

slender yarrow
#

damn...

#

I suck ass at multiplayer man. I just cant get the concept down.

grand kestrel
#

Thats normal when you start

#

But heres the thing

#

Whatever the client decides to do with that information doesn't affect anyone else

#

Because the server isn't basing anything off that

#

The clients do what the server says (or they can hack it and not do it, all they're doing is getting the wrong result!), the server never does what the client says

#

The only thing the client should really be telling the server is the inputs they pressed

slender yarrow
#

yeah i get this. thats the problem

#

i cant apply it in reality

#

i get the sabstract concept

#

abstract

grand kestrel
#

Just takes getting used to, it wont be fast/easy

#

Takes a long time and a lot of frustration

slender yarrow
#

Im letting the client increase its own movement speed at the end

#

because this was the only way i could get it working properly. Where movement speed was working on the server and the client

grand kestrel
#

I can barely see that, its so low res

slender yarrow
#

middle mouse click to browser

grand kestrel
#

Ah

#

There is no graceful way for a beginner to do sprinting as it requires inserting your own replicated flags into the client-side prediction system

#

Meaning, its very advanced

slender yarrow
#

so its not even possible to do 100% properly through blueprints

grand kestrel
#

Definitely not

eager geyser
#

hey guys is gamelift supported for a droid and ios

umbral adder
#

@eager geyser i dont think so

eager geyser
#

so what are the possible scenarios of getting dedicated server hosting for android are?

halcyon cradle
#

as far as i know gamelift should work for you

#

what you are uploading to gamelift is only a binary and gamelift will create instances of it

eager geyser
#

but the gamelift sdk source code specifically used macro #IF WINDOWS
IFΓ—64 And #IF LINUX. So that means it's only for Windows and linux

#

did anyone created android Multiplayer game with dedia Ted server hosting with gamelift or any other service

halcyon cradle
#

check out how to create a dedicated server from the editor , that means even if you are creating an android app your server can be an .exe

finite willow
#

Sorry to push my problem again. I really hope someone here did experience something similar and can help me. I am totally lost by now.

Original Message:
Hey guys. I am fairly new to Multiplayer inside Unreal Engine and encountered a problem which took me a while to find the cause of it. When the player hits another player with a melee attack I do a trace. On the client everything works fine. However I figured that the server is only registering the hit event when it actually has the client performing the melee attack in the viewport. Any attacks from clients outside the servers "Viewport" are not registered. Can anyone help me with that?

meager spade
#

if you are tracing from the skeleton

#

you need to ensure the server is updating the bones

#

otherwise server will be in a or t pose (model pose)

finite willow
#

@meager spade I am currently testing exactly this. Glad you had the same idea. Do you know where I can set the tick option for animations? Is it Mesh->VisibilityBasedAnimTickOption ?

#

Is there any setting directly in the editor for this?

finite willow
#

woah where? 😦

meager spade
#

on the skeletal mesh

finite willow
#

I must be blind πŸ˜„

finite willow
#

found it ... omg

#

thank you so much

#

this made hit detection almost work perfect now

#

there are times when I hit the enemy (particle spawns at impact point) but the server doesnt retrieve the actor and therefore doesnt do the damaging stuff

#

but its a whole lot better now than before

dark sandal
#

Hey

#

uuh weird problem

#

so my game checks if a line trace hits a player when i left click

#

which is replicated by the server

#

it works fine

#

but damage is weird

#

lemme share images

#

as you see both server and client recognize it has done 1 damage

#

but when i switch to the other player he does more damage

#

and if i switch back to the main player he will do 3

#

and so on

slender yarrow
#

Why would the server not detect pitch for this? For some reason the server is only updating the yaw. Any ideas?

finite willow
#

@dark sandal I think you need to replicate your health variable

dark sandal
#

it was replicated

#

i had to rewrite the whole health and damage giving system

high current
#

So I am running into some heavy rollback with physics handles, while the server (left) sees everything as it should be, on clients, whenever the physics handle component in the character is active, it seems the update rate just goes down tenfold

#

everything on the character side runs on the server, with values replicating back to the client when needed, its just that I cant seem to figure out what is causing the rollbacks

north dagger
#

Hello guys,
I've created the lobby system using "Advanced Sessions ". And
" Lobby Player Controller" the contained player info "structure" variable , on "servertravel" player info variable not transferred new the player controller. what this is problem solution?

#

"Looby GameMode"-> On postlogin event All players info added to array and if all player ready state game starting game. All player created to showing loading screen widget and after servertravel -> loaded to TestMap.