#multiplayer

1 messages · Page 430 of 1

hasty adder
#

It’ll increment on it own if it’s in use

copper grove
#

let me ask yal 2 questions:

  1. i've seen a lot of example projects not use SWITCH HAS AUTHORITY , is that to make things faster?
  2. What kind of player code should always use SWITCH HAS AUTHORITY? for example can I exclude it from things like jumping, sprinting, shooting, etc... to make the logic on the client side faster
fossil spoke
#

@copper grove SwitchHasAuthority has nothing to do with how fast the code runs. Its a node that helps you determine what Network context the code is being run on, typically either Server (Authority) or Client (Remote).

copper grove
#

right but that in itself

#

that check

#

for something like sprinting or jumping

#

needs to go through all that process

#

and im wondering if that affects performance, client asks to jump, has to run that code on server, server does it, tells client to jump

fossil spoke
#

That is a necessary part of networking in an Server Authoritative architecture. The Server determines the state of the game and the Clients simulate that state, one of the main benefits of that is that it stops many forms of cheating.

#

The Client tells the Server what inputs it wants to have processed in order for the Server to update the state of the game to reflect that Players choice of inputs.

copper grove
#

I've heard recently that some games forego cheating prevention, in order to benefit performance, and I'm wondering if this would be useful in this case

fossil spoke
#

Thats up to you.

winter plover
#

It's less performance and more perceived latency handling

#

If you do something client authoratative you can do alot of FX and hit reactions immediately and dont need to wait for the server to confirm anything

#

it also opens up alot of exploits and general consistency issues

#

@copper grove

#

What you can do sometimes with server authoritative approaches is clientside prediction. The client basically executes things ahead of server confirmation, where the client basically assumes that they are okay to do something (judging by the world state they currently know), and the server corrects them on the off chance that they are wrong. You can do this for most movement stuff really and anything that requires some immediate feedback upon input.

copper grove
#

That makes sense. Correcting them if they are wrong. Especially if it isnt score critical let them go ahead and execute and then correct if needed.

winter plover
#

yea you basically have to consider for everything how important it is to keep it consistent vs. how quickly you want client feedback

#

this is a pretty long one, but it explains the mindset behind writing networked stuff pretty well

#

with a bunch of visual examples

copper grove
#

Nice ill check it out

#

👍

hasty adder
#

Cheating asside if you don't do things right things get of sync real quick

copper grove
#

my game is fine, dont get me wrong... i just wanted to see if there was instances where i could cut corners, for the sake of performance

#

im going to test nativizing just the player character (where most of the code is running from) to see how that affects network performance

winter plover
#

it shouldnt really affect network performance all that much

#

it might make the class maybe run faster on the CPU, but you are still sending the same packets pretty much

bronze arch
#

Hello guys i am doing "get steam UID" if not working on pc "steam" not gave me "error" or "not login". so, when start game without steam, gets my local computer name. not get any error. Why?
installed advanced sessions

#

idk which topics for that, posted here.

thin stratus
#

The PlayerName on SubsystemNULL is the Computer Name

bronze arch
#

but subsystemNULL are disabled? or how perm disable it ablobthinking

thin stratus
#

It's the fallback subsystem

#

If you don't have steam on, it will fall back to it

bronze arch
#

i have steam but without start gave local computer name i want to gave error if not work on pc steam

thin stratus
#

Then you need to check if the Subsystem is properly logging you in

#

I haven't touched that yet and i'm not sure if Advanced Sessions plugin has that feature

bronze arch
#

sad

#

Thanks then

#

ohhhh i did it nice clue BolbHyper Thanks @thin stratus
how to: Just Disable it:

#

Sry for my bad mind ablobsadpats (Cuz its defaulty enabled)

bitter oriole
#

Though this might be annoying for development & testing

#

The NULL OSS is pretty useful since you can work on a local network without Steam etc

bronze arch
#

no mate only i want work on steam.

#

then disabled it no longer get your computer name and gave "unlogged" error

#

i want to this anyway thanks

bronze arch
bitter oriole
#

You need to use Steam to connect

#

Which is why I suggested earlier that you keep the null OSS for development

bronze arch
#

Still disable Null OSS. But if steam force closed then opens both server and client and typed open 127.0.0.1 has connect without problem.

bitter oriole
#

Either you use Steam for your online or not

#

If you use it, you need to connect with a steam handle

#

Not an IP

bronze arch
#

damn so cant fix it? need to connect server IP with steam UID

karmic briar
#

hi

#

can anyone do a tutorial on how to make game / setup your game in spatialos

bitter oriole
#

@bronze arch When Steam is the OSS, you need to use "open steam.<uid>"

thin stratus
#

@karmic briar If you need someone to make a tutorial just for you, then you should think about hiring an tutor instead.

#

Or just learning the stuff yourself.

#

Not everything has or will have a tutorial

mighty rover
#

I've been testing out our dedicated server with a few test sessions and it's been responding really well. So far though, the tests have been a single instance of the session and auto-directing our players into a single session. I know common practice would be to run multiple sessions per server, but any tips on how I would go about setting up single dedi-server that would create new sessions as needed?

#

if one is tied up with port 7777, will the next work over 7778, 7779, etc...?

rare cloud
#

I search a way to check if I'm client side without using HasAutority since this code should be executed inside UGameInstance::Init()

#

I can use a preprocessor but can create some bug with PIE :/

#
if (!IsRunningDedicatedServer())
{
}

did the trick 😄

karmic briar
#

@thin stratus i can find someone but i dont know who have try it

#

im willing to spend the money

#

but i look into the documentation nim confused af

bitter oriole
#

What's your motive for spatialos ?

#

I mean I don't understand how people who're not building a MMO for a large company would need it

wary willow
#

TBH, anyone (even solo) could do a SpatialOS project.

#

The problem lies...with their pricing

#

Customer Support could be better also

hasty adder
#

Everyone's first game is a MMO tbh

worn nymph
#

not sure where to ask this. anyone know how i can make an actor not net relevant for its owner so it doesnt replicate to the owner but still replicates to remote clients??

hasty adder
#

Curious if anyone has invented a solution to ping a dedicated server non steam when not connected for a browser for example

#

Both Linux and windows clients

fluid glacier
#

Somtimes I wish I could Just search channel on here. I am certain my problem has come up before. G:\Unreal Projects Backup\CoopProject\Source\CoopProject\Private\Player\SCharacter.cpp(227) : error C2039: 'GetLifeTimeReplicatedProps': is not a member of 'ASCharacter' CompilerResultsLog: G:\Unreal Projects Backup\CoopProject\Source\CoopProject\Public\Player\SCharacter.h(17): note: see declaration of 'ASCharacter' CompilerResultsLog: G:\Unreal Projects Backup\CoopProject\Source\CoopProject\Private\Player\SCharacter.cpp(228) : error C2270: 'GetLifeTimeReplicatedProps': modifiers not allowed on nonmember functions CompilerResultsLog: G:\Unreal Projects Backup\CoopProject\Source\CoopProject\Private\Player\SCharacter.cpp(229) : error C2653: 'Super': is not a class or namespace name CompilerResultsLog: G:\Unreal Projects Backup\CoopProject\Source\CoopProject\Private\Player\SCharacter.cpp(229) : error C2065: 'OutLifeTimeProperty': undeclared identifier CompilerResultsLog: G:\Unreal Projects Backup\CoopProject\Source\CoopProject\Private\Player\SCharacter.cpp(230) : error C3861: 'StaticClass': identifier not found CompilerResultsLog: G:\Unreal Projects Backup\CoopProject\Source\CoopProject\Private\Player\SCharacter.cpp(230) : error C2248: 'ASCharacter::CurrentWeapon': cannot access protected member declared in class 'ASCharacter' CompilerResultsLog: G:\Unreal Projects Backup\CoopProject\Source\CoopProject\Public\Player\SCharacter.h(78): note: see declaration of 'ASCharacter::CurrentWeapon' CompilerResultsLog: G:\Unreal Projects Backup\CoopProject\Source\CoopProject\Public\Player\SCharacter.h(17): note: see declaration of 'ASCharacter' So I have included Net/UnrealNetwork.h , but I am finding conflicting info as to whether or not it just UnrealNetwork.h or the way I have it.

#
{
    Super::GetLifeTimeReplicatedProps(OutLifeTimeProperty);
    DOREPLIFETIME(ASCharacter, CurrentWeapon);

}```    From My cpp
hasty adder
#

Prob need to see the .h lines

fluid glacier
#

#include "SCharacter.h"
#include "Components/InputComponent.h"
#include "Camera/CameraComponent.h"
#include "GameFramework/SpringArmComponent.h"
#include "GameFramework/PawnMovementComponent.h"
#include "Components/CapsuleComponent.h"
#include "Core/Characters/Components/S_HealthComponent.h"
#include "CoopProject.h"
#include "Net/UnrealNetwork.h"
#include "SWeapon.h"

#

from the header file of my character /*The current weapon equipped*/ UPROPERTY(Replicated) ASWeapon* CurrentWeapon;

winged badger
#

#include "UnrealNetwork.h"

#

virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override; in header?

hasty adder
#

Why yes... Replication might need network libraries

winged badger
#

from your error, i'd guess you're missing the const bit

warm summit
#

hey guys can you tell me why the rotation is not replicating? If I stand still and rotate, the player moves really fast from one rotation to another and if I move, it always looks North, on all players (which makes no sense to me). I've had this problem for a long time and it's driving me crazy...

slim holly
#

because it's a multicast

warm summit
#

no wait

slim holly
#

just do onrep with rotation variable

#

that skips owner

warm summit
#

nonono I got it

#

my problem was I rotated the mesh and not the 'cylinder'

#

don't know why it makes such a mess bc my cylinder is a child of the mesh but ok

#

now I have another problem

#

on my client side, when I move it laggs/jitters

#

any idea?

slim holly
#

because it tries to set the rotation based on delayed value from server

#

thus the "skip owner" I mentioned

warm summit
#

How to skip it?

#

nevermind

#

somehow after some attempts it suddenly worked

#

probably a bug

sharp pilot
#

hello guys, I'm a newbie in the world of unreal, I'm doing multiplayer by blueprints using the steam plugin the only thing I do not know, is that having 1 single character when another user enters uses that same character and the skills are superimposed, To say that I use skill 1 and without the other pressing it is activated. sorry for the English

solar flower
#

For a multiplayer back-end (finding current sessions in p2p, storing player data, etc...) do you normally go the node.js route? Which database implementation do you use?

twin vault
#

I used a python rest api with mysql on gcloud's compute engine

#

but in my case, requesting and saving data was uncommon

#

for something realtime i believe its something really different

fluid glacier
#

Thank you @winged badger for the clarification. I ended up deleting the code and putting back in again. I think i had something misspelled somewhere.

jagged garden
#

@solar flower steam does all the matchmaking stuff for you and you could look into playfab for data and such

solar flower
#

Steam doesn't handle cross-platform matchmaking does it?

jagged garden
#

oh cross platform I wouldn't think so

polar pine
#

I believe MySQL has too many issues... Even the other database channel discourage people from ever talking about MySQL...

#

Steam used to do that for Portal 2, but not sure how that's handle...

solar flower
#

What issues do people run into using it? And what do they go with instead?

#

I'm doing p2p matchmaking cross-platform so a phone could technically be the listen-server

jagged garden
#

they might have a way to find sessions on other platforms and route it to their servers

solar flower
#

Not sure how dynamic IP comes into play when searching for the session

jagged garden
#

but I dont have any clue how you would do that

#

joseph you might be able to join via ip

#

but I dont know how you would find the actual server

solar flower
#

My current thought is that i'd store the IP of the host in a database, then show a list of all IP hosts to the clients. When the clients pick one to join, they just join that IP and enter that session

#

I've got a mobile phone connecting to a PC and playing together real-time currently

#

But that's using a hard-coded IP

jagged garden
#

that would work on lan

#

but there would be no way to route the connections

#

over online

solar flower
#

Why not?

polar pine
#

can't client pc be used as a host? I remember back in the good ol' Xbox 360 days where we had host migration...

jagged garden
#

I'm not sure what its called but thats how it is so easy to connect over steam because you dont have to deal with port forwarding and what not

polar pine
#

dedicated server?

solar flower
#

Yea, the NAT issue

#

Nah, p2p

jagged garden
#

obviously fortnite does it

#

but thats dedi

polar pine
#

VPN channel?

solar flower
#

Steam does some trickery to allow them to punch through, if p2p doesn't work I'll just go dedicated. But it'd be cool to try

polar pine
#

Just realize it still requires port forwarding...

jagged garden
#

lol

polar pine
#

Joseph, when you install steam, steam basically opens the firewall for each and every games you install..

#

just fyi

solar flower
#

ah

polar pine
#

if you go to start -> run and type wf.msc

#

you'll see a whole list of steam games opened up based on application location.

solar flower
#

Could i do that from a game install without using steam's onlinesubsystem for matchmaking?

#

That would solve the PC issue, assuming i could track down which port it opened

polar pine
#

You'd have to tell the client to open firewall, or let the game do that for you. When you install games, firewall will typically ask you if you want to allow ports to be open regardless.

#

As if that's not the most standard way when you install games nowadays...

jagged garden
#

but theres still the issue of the router

#

the router has to open that port too

#

so I have no clue how steam bypasses that

polar pine
#

can't imagine using https protocol...

solar flower
#

When i port forward, that opens the port on the router?

polar pine
#

pc firewall will open ports for the games you install, thus does not open port on your router.

#

You'd have to manually configure your router to open the ports, otherwise, some ports are already open on your router by factory recommendations.

solar flower
#

Sounds like i don't need to worry about it if the PC ports are open

#

And that the PC ports are opened by installing the game through steam

polar pine
#

some of those ports are often used for things like email (20), https (443), and ftp services (25)?

#

I think I got the ports wrong. Correct me if I did.

#

Yeah I did get that wrong.,.. port 20 is FTP, Email (SMTP) is 25...

solar flower
#

So you guys don't do any back-end web services for your multiplayer?

#

Storing experience, leaderboards, custom matchmaking, etc

#

Or you pay playfab for it?

#

Seems like the quicker route

jagged garden
#

playfab is relatively easy

umbral adder
#

why is it that wehn i to get get player state from pawn its invalid but when i do get player pawn and then get player state its valid in basepawn in srv_death rpc

static lynx
#

So I'm calling a interface on the server version of an object. that object is SUPPOSED to call the client side event, but it just runs it on the server instead. Any ideas why?

thin stratus
#

Well, is that actor owned by the client?

#

Cause otherwise a ClientRPC has no "owning client" it can call on

summer tide
#

Anybody has a good tutorial on RootMotion animation network replication?

hasty adder
#

@polar pine I believe if you are not using steam what's to stop you from using an installer like installshield or a .sh script to run commands to open ports for the end user

rare cloud
#

@summer tide you want a optimized solution like Fortnite or simply replicate an animation ?

#

how many players can handle your game ?

grand kestrel
#

Heh.. Fortnite uses root motion?

#

Doubt it

rare cloud
#

why Fortnite can't use Rootmotion ? @grand kestrel

grand kestrel
#

What lol

#

Root motion is unresponsive there's no way it would be good in an fps

meager spade
#

they do use root motion in fortnite

#

not for normal animations but for montages

rare cloud
#

actually you can enable physics rotation during root motion

meager spade
#

root motion is only safe in montages when networked

rare cloud
#

yup

grand kestrel
#

Thought this was about locomotion for some reason

#

Sorry

rare cloud
#

no problem 😄

grand kestrel
#

I'm tired, it's 1.30am and I'm sitting in my car waiting for a tow truck, so I'm trying to kill time

rare cloud
#

haha

grand kestrel
#

Engine sputtered and died

rare cloud
#

erf :/

grand kestrel
#

My life right now.. My luck sure sucks

rare cloud
#

but yeah I don't think Fortnite use plenty of rootmotion animation, but actually the Gameplay Abilities give some RootMotion node which is super efficient when you have a large scale game and you don't want to play montage on server side, so you simply need to play the rootmotion on server

#

to make it simple, Client play montage, server play rootmotion using a Vector Curve for example

meager spade
#

-+

#

whoops lol

ember needle
#

All, I'm a little puzzle about something related to sound and MP. When a player fires, it generates a server side event that gets multicasted to all players. One of the effects of this is to play a sound effect at location of the shooting. Unfortunately, after a certain distance the players cannot hear the sound (not for attenuation reasons, because the player with the listening server can hear these sounds at the same distance).

What are my option to make shooting sounds always relevant?

#

Do I need to make the actor calling "play sound at location" always relevant?

slim holly
#

it should be tied to network relevancy, along with the multicast

#

other than that, it's playback configuration

ember needle
#

how do you tie a sound to network relevancy i guess is my question

#

right now the weapon (replicated) issues the call to sound

slim holly
#

the multicast event that triggers the sound

ember needle
#

so should i set the gun to always relevant?

slim holly
#

multicast events do not trigger outside relevancy range

ember needle
#

oh

#

so how can I make a sound heard even outside relevancy?

#

these are sounds 2km away

slim holly
#

then you need to make the whole actor always relevant

ember needle
#

the actor that issues the multicast?

slim holly
#

but like 2km is quite a stretch

#

I wonder if forcing a net update could override that 🤔

#

also sound from 2km away is probably quite an event itself

ember needle
#

so the actor with the multicast should be always relevant...?

slim holly
#

well, yea that would be one solution

ember needle
#

ok thank you

slim holly
#

but like, in comparison a thunderstrike has about 5km hearing radius

#

so you're talking quite a bang there

ember needle
#

it's guns in a forest

#

they can be heard at 750-1000m away

#

however right now they can't after 500m or so

slim holly
#

making it always relevant is going to force it to use bandwidth all the time tho

#

even if it's way past visibility range

ember needle
#

yes that's why i won't do that on the player

#

i'm thinking maybe on the bullets themselves

#

on begin play

#

I mean, sniper rifles shoot at 1km

#

so they just have to be always relevant anyways

slim holly
#

I don't think you can do that on bullet itself tho

#

wouldn't work on automatic weapons in that case

ember needle
#

why not?

#

hum

#

i'm trying to see what is the default network relevancy distance

slim holly
#

refire delay being less than 1 tick would cause duplicate playbacks

#

I mean sure, you could increase the relevancy distance for loud weapons

ember needle
#

can this be done?

slim holly
#

should be in the actor settings

ember needle
#

i can't even see what the default distance is

#

Oh sorry probably is 225000000,0

#

Net cull distance squared

#

I don't understand what this means though 😄

#

will google

#

ok so it's 15000 so 150meters

summer tide
#

@rare cloud Not like Fortnite. Simply replicate root motion animations such as a player's all movements.

#

So I'v speed set to 0 - 2. I need to know what to do to replicate my player's movements. Which variable and when they need to be replicated?

keen thorn
#

anyone familiar with Playfab?

twin juniper
#

For some reason my game is trying to replicate a destroyed actor, and this causes it to crash.

winged badger
#

what flags does it have? expand the UObject until you can see them

static lynx
#

@thin stratus sorry, i was asleep. no, it doesn't own it. whats the best way to call it then?

thin stratus
#

In Server owned Actors you can only perform Multicasts from Server to Client

#

So you either need to make sure that the Client owns it (SetOwner and pass the PlayerController or something that is owned by that)

#

Or use another Actor that is owned

#

Only one client at a time can own an actor

#

So if two or more clients can use the actor at the same time, then you need to rethink your system

static lynx
#

I gotcha. yeah, I thought using a interface would solve that problem

#

guess I was wrong. thanks. 😛

odd charm
#

i have an actor that is replicated, placed in the level, so not spawned manually. is there a way for the actors to communicate with the server? usually those actors don't have a owning connection, so i can't really use RPC's, or is there a way?

twin juniper
#

@winged badger what do you mean?

#

What do you want to see?

winged badger
#

if you expand the UObject hierarchy in locals for that Actor

#

you can see the flags it has

twin juniper
#

This? ObjectFlags?

winged badger
#

yeah, that actor wasn't destroyed

#

something fishy is going on, if that is the same Actor

twin juniper
#

Is there a reason why it would crash at

{
    for ( int32 viewerIdx = 0; viewerIdx < ConnectionViewers.Num(); viewerIdx++ )
    {
        if ( Actor->IsNetRelevantFor( ConnectionViewers[viewerIdx].InViewer, ConnectionViewers[viewerIdx].ViewTarget, ConnectionViewers[viewerIdx].ViewLocation ) )
        {
            return true;
        }
    }

    return false;
}```
#

At IsNetRelevantFor()

#

It's giving an access violation

#

@winged badger Any ideas? :o

winged badger
#

not really, the first screen shows Tick function being null, among other things

#

second doesn't have RF_Destroyed

#

have you been playing with ReplicationGraphs?

twin juniper
#

Nope!

keen thorn
#

@yaakuro#6648 those placed actors can be marked as replicated, in that case they are owned by server, unless they are possessed by a player. All actors really belong to server and only possesed actors can belong to controlling player.

#

RPC works if u call from server

#

@yaakuro#6648 above

twin juniper
#

@winged badger what does RF_Transactional mean

odd charm
#

@keen thorn the thing is, the actor plays a sound using an audiocomponent, then using onaudiofinished to check when it finished it. that event i like to use on the server side to inform all other actors on the clients to continue to another sound for example

#

but i can't use RPC somehow

#

just to tell on the server that the audio finished

gleaming vector
#

so, I keep running into issues replicating objects that don't have an explicit owner

#

basically, what I'm doing is that I have some FItemStack with a NetSerializer

#

inside, I have an array of UItemPerks

#

that are instanced

#

ItemPerks are instantiated per-item, but they don't have a good outer

#

does anyone know of a good outer to give these objects so that they replicate without crashing?

winged badger
#

funny thing

#

unreal can change the outer during replication if its not an Actor

gleaming vector
#

how would that happen?

winged badger
#

it just does

gleaming vector
#

that sounds exactly like what I want

#

hmm

#

well, I'm still getting issues

winged badger
#

i had an ActorComponent as the outer

gleaming vector
#

because like

winged badger
#

replicated UObject's outer was Actor owning it

gleaming vector
#

FItemStack can't replicate without being a property of a replicated actor

#

so if I can somehow get the object replicating the item stack during NetSerialize and set the outer for all of it's subobjects

#

that would fix this issue right up and I don't have to deal with changing ownership

winged badger
#

the UObjects are replicated?

#

ones in the Stack

gleaming vector
#

Stack is a struct with a NetSerialize function

#

Perk is a uobject that doesn't really have an actor as it's outer

#

because it's just stored in the Stack

winged badger
#

what creates it? CDO from editor?

gleaming vector
#

Stack is replicated either because it's in an inventory or it's in a ItemStackWorldActor

#

an "Item Generator" which is usually instanced

#

the item generator is not replicated nor is it a suitable outer

twin juniper
#

@winged badger Sorry to interrupt you two, but do you know if there is a way to check if the object is nullptr before calling Actor->IsNetRelevantFor()?

gleaming vector
#

IsValid

winged badger
#

well, you're not calling it, so thats a problem

#

engine is

twin juniper
#

yeah

#

And the engine doesn't check if it's valid or not.

gleaming vector
#

oh rip

#

stop replicating null objects lol

twin juniper
#

I don't know how :(

winged badger
#

why do they have to be inside the struct?

#

the ItemPerks

gleaming vector
#

because items can be passed around

#

and they have their own instance data

winged badger
#

i mean you can just put a weak pointer there, and keep them alive and in sync with a combination of TArray and FFastArraySerializer callbacks

#

as long as they are replicated, so their NetGUID has meaning

gleaming vector
#

yeah, but then who owns the object?

winged badger
#

whoever has the array as member

#

in that case

gleaming vector
#

but the item stack has the array 😛

#

i can't give it to the player, because a player might not be holding the item (it might be just laying on the ground)

winged badger
#

so that is some global manager?

gleaming vector
#

no

#

the item stack holds the array of instanced perks

#

an item stack is only replicated when either in a player's inventory or as a property of a replicated actor

#

the problem is that the stack can pass around freely, so the owner of the perk can't be one of those objects except when it's replicating

winged badger
#

what is the relationship between item and itemstack?

#

and the perks

gleaming vector
#

Item and Item Stack is an interchangable term here

#

(technically my code makes a slight distinction, but it's irrelevant for this problem)

#

Item Stack has an array of Item Perk instances

#

Perks are UObjects that need to be replicated

#

ItemStack is a struct that is only replicated as a replicated property tied to an actor

#

the process that a player uses to get an item is they approach like a Chest

twin juniper
#

So... UHH, how do I stop replicating destroyed actors/null actors :x

gleaming vector
#

and interact with it

#

the chest generates items with perks

#

creating a WorldItem actor that is replicated (and contains the Item Stack)

#

player interacts with the WorldItem to put the item into their inventory

#

Inventory is just a component on the player

winged badger
#

perks are completely random?

gleaming vector
#

yeah

#

they can be

#

they are designed to do both diablo-type random modifiers or things when gameplay events happen (i get shot, so do something to the shooter)

#

an Item can have any number of Perks

#

i just need to replicate the perks

winged badger
#

why not just simulate? sending a seed/instructions to the client how to create the exact same perks on its side

#

isn't that difficult

gleaming vector
#

because there is instance data in the perks that may be replicated

#

ie: if a perk is a killtracker

#

i need to replicate the number of kills that perk is tracking

#

for example

#

and if I give that item to another player, the perk should keep tracking the kills (because the tracker isn't player specific, it's item specific)

#

I am pretty sure it's possible to replicate a UObject without a static outer

#

I'm just trying to figure out how to do it

winged badger
#

it won't replicate

#
bool UAttributeComponent::ReplicateSubobjects(class UActorChannel *Channel, class FOutBunch *Bunch, FReplicationFlags *RepFlags)
{
    bool WroteSomething = Super::ReplicateSubobjects(Channel, Bunch, RepFlags);

    for (USolsticeBuffBase* Buff : ReplicatedBuffs)
    {
        if (IsValid(Buff) && Buff->IsReplicated())
        {
            WroteSomething |= Channel->ReplicateSubobject(Buff, *Bunch, *RepFlags);
        }
    }
    return WroteSomething;
}
#

you need this bit as well

gleaming vector
#

I will make this object replicate whether it likes it or not 😛

winged badger
#

for them to be added to a bunch

#

they have to be a part of an Actor

gleaming vector
#

I know

#

I just need to figure out how to add it to the bunch during NetSerialize for my ItemStack

winged badger
#

pretty sure that part comes with RepLayout and PropertyChangeTrackers, before NetSerialize is called

twin juniper
#

Would it be okay for me to add my own if check?

#

if (Actor && Actor->

winged badger
#

i've never seen that happen

#

so im guessing you... spiced up your network code

#

forced a net update?

#

flushed some dormancies?

twin juniper
#

Oh

#

I override IsNetRelevantFor()

winged badger
#

that won't help

twin juniper
#

I have to

#

It's my own setup

winged badger
#

that's fine

#

@gleaming vector wondering how long till you surrender and replace that FItemStack with a full Actor

gleaming vector
#

probably never

#

I intend to have literally thousands of items

#

Actor is too high of an overhead for this

winged badger
#

then simulate

gleaming vector
#

that difference between "Item" and "Item Stack" that i mentioned before is there

#

Item is a UDataAsset that I use to define what the item is

#

ItemStack is that Item + Stack Size + Instance Data (like perks)

#

I replicate Instance data no problem. Perks are being a bitch

#

oh

#

I dont even get a valid PackageMap

#

wtf

twin juniper
#

if ( Actor->IsNetRelevantFor( ConnectionViewers[viewerIdx].InViewer, ConnectionViewers[viewerIdx].ViewTarget, ConnectionViewers[viewerIdx].ViewLocation ) )
if ( Actor && Actor->IsNetRelevantFor( ConnectionViewers[viewerIdx].InViewer, ConnectionViewers[viewerIdx].ViewTarget, ConnectionViewers[viewerIdx].ViewLocation ) )

#

I'm just going to add this, and see what happens

gleaming vector
#

hummm

#

UObject::Rename lets me change the owner of the object

#

I can pass nullptr as the new name and it preserves the name

#

this is a viable strategy

#

just change the item stack's replication owner

winged badger
#

i do not remember good experience with Rename

meager spade
#

Rename is fine, as long as you dont rename twice

#

cause that causes a crash 😄

mighty rover
#

Has anyone ever created their own service to start/stop Unreal Engine dedicated servers as needed based on user load? what I'm looking at doing is automatically starting up a UE4 dedicated service (same IP, new port) process per match (1v1), then when the match is over, shut down the UE4 dedicated server instance

fossil spoke
#

AWS

mighty rover
#

@fossil spoke - but AWS is a host. I have a server already - they have GameLift, but GameLift is outdated to 4.18 and I'm using 4.20

#

I want the similar functionality of the GameLift fleets, but is there anyone else who's done it?

#

and/or is there a way that Unreal Engine Dedicated Server handles this for redirecting players into the new port, if it's available, rather than hard coding it.

hasty adder
#

Ok. Just before I start a trek on modular characters. I'm thinking. Players define local there player. Set some enum or int to define various ID for parts.. on join there a pseduo spec. Opportunity on join. Server tells player to send data.. so it client side loads save game and feeds several values to aet. These are value called on spawn pawn for client.. should I be worries about midgame join? All values would be stores in paper so everyone has it from@the servere

grand kestrel
#

Just make sure you validate anything the client sends

keen thorn
#

@odd charm hmm.. possible to notify player pawn with onaudiofinished? then call RPC from there?

lost inlet
#

@twin juniper that issue is a few hours old but Actor isn't nullptr

#

you're not doing anything by modifying this code

#

the crash is in your own game code

#

but you don't have the symbols for whatever reason

twin juniper
#

I think by mistake, I disabled symbols in visual studio but never figured out how to turn it back on. @lost inlet

#

Do you know how to turn them on again?

lost inlet
#

when you build the DLLs locally, it should spit out PDB files alongside the DLL

#

which VS will load anyway

#

if someone else on your team built the DLLs and you don't have the symbols, then you might get something like in that screenshot

twin juniper
#

The crash doesn't occur for like 3 minutes

#

I can run the game for 3-5 minutes before any issues occur

#

There is a little yellow bar on visual studio that said "It seems to be taking a long time to load, do you want to disable symbol loading?"

#

I clicked it, and ever since, my debug messages have been useless.

lost inlet
#

whatever native class BP_Minion is will have a IsNetRelevantFor implementation

#

and that game-specific implementation is what crashes

twin juniper
#
{
    // We want to see if any of the Units or Structures that our PlayerController owns are within the net relevancy distance

    const AInGameDeathAlleyPlayerController* PC = Cast<AInGameDeathAlleyPlayerController>(RealViewer);

    if (GetOwner() == RealViewer)
    {
        return true;
    }

    for (AUnit* MyUnit : PC->UnitsWeOwn)
    {
        if (IsWithinNetRelevancyDistance(MyUnit->GetActorLocation()))
        {
            return true;
        }
    }

    if (IsWithinNetRelevancyDistance(PC->BaseActor->GetActorLocation()))
    {
        return true;
    }

    return Super::IsNetRelevantFor(RealViewer, ViewTarget, SrcLocation);
}```
#

This is all I have though.

lost inlet
#

and could a unit disappear during gameplay?

#

there's a surprising lack of nullptr checks here

twin juniper
#

Yes

#

Well, AMinion inherits from AUnit

thin stratus
#

Add some nullptr checks

#

maybe something that is not as rough is what I just posted

twin juniper
#

Makes sense.

#

It still seems strange that the debugger doesn't tell me what exactly the issue is though, like it doesn't go to the exact line

thin stratus
#
bool AUnit::IsNetRelevantFor(const AActor* RealViewer, const AActor* ViewTarget, const FVector& SrcLocation) const
{
    // We want to see if any of the Units or Structures that our PlayerController owns are within the net relevancy distance
    if (GetOwner() == RealViewer)
    {
        return true;
    }
    
    const AInGameDeathAlleyPlayerController* PC = Cast<AInGameDeathAlleyPlayerController>(RealViewer);
    
    if(PC && PC->IsValidLowLevelFast())
    {
        for (AUnit* MyUnit : PC->UnitsWeOwn)
        {
            if(MyUnit == nullptr || !MyUnit->IsValidLowLevelFast())
            {
                continue;
            }
        
            if (IsWithinNetRelevancyDistance(MyUnit->GetActorLocation()))
            {
                return true;
            }
        }
        
        if(PC->BaseActor && PC->BaseActor->IsValidLowLevelFast())
        {
                if (IsWithinNetRelevancyDistance(PC->BaseActor->GetActorLocation()))
            {
                return true;
            }
        }
    }
    
    return Super::IsNetRelevantFor(RealViewer, ViewTarget, SrcLocation);
}
#

Something like this maybe

lost inlet
#

well you need to build the code, which will generate symbols

#

also i do not like to give people exact solutions

thin stratus
#

Not sure how needed the lowlevel is

twin juniper
#

I did this```bool AUnit::IsNetRelevantFor(const AActor* RealViewer, const AActor* ViewTarget, const FVector& SrcLocation) const
{
// We want to see if any of the Units or Structures that our PlayerController owns are within the net relevancy distance

const AInGameDeathAlleyPlayerController* PC = Cast<AInGameDeathAlleyPlayerController>(RealViewer);

if (IsValid(PC) && IsValid(GetOwner()))
{

    if (GetOwner() == RealViewer)
    {
        return true;
    }

    for (AUnit* MyUnit : PC->UnitsWeOwn)
    {
        if (IsValid(MyUnit) && IsWithinNetRelevancyDistance(MyUnit->GetActorLocation()))
        {
            return true;
        }
    }

    if (IsWithinNetRelevancyDistance(PC->BaseActor->GetActorLocation()))
    {
        return true;
    }

}
return Super::IsNetRelevantFor(RealViewer, ViewTarget, SrcLocation);

}```

#

Becuase IsValid also checks if it's not pending kill

thin stratus
#

Whatever solves your issue

twin juniper
#

I shall see soon

polar pine
#

Help me understand this insane logic I have in my head. In the game of Destiny, people are able to seamless join into another client's party by going into a specific level or area they walk in.

#

But that's only possible within it's defined area or destination in Destiny.

#

Is it possible to have seamless integrated player joining in a dynamic area of the map?

#

I guess I need to draw it out before discussing about this hmm

meager spade
#

sure its possible

polar pine
#

I think I know the answer to this but what is the maximum player connection can you have in a single game session?

meager spade
#

how ever many you like

#

fornite has 100 😄

polar pine
#

I was thinking at most 200... but that sounds insane.

meager spade
#

that does, with replication, that is a lot to handle

polar pine
#

alright thanks!

lost inlet
#

you need to be very careful with optimisation too, including networking

meager spade
#

unless you split each section into a different server

#

so when you enter a new area, you switch servers

#

and i know thats how destiny do it, but destiny never has 200 connections at a time

polar pine
#

That I know... they had something at least 32 players at a time.

twin juniper
#

Hey sswires, I just wanted to validate something with you. Is there a way to turn my symbol loading back on?

spiral badge
polar sun
#

If I GetGameTimeInSeconds within a widget blueprint, will the time be the same for all characters?

#

I'm trying to make a timer that keeps track of how long a player takes to get to the end of the level.

glacial lotus
#

In 4.21 when I PIE without dedicated server the second player screen seems blocked, at least 3d though the FPS indicator and other stuff updates, However the first player (acting as server) screen works fine. Any ideas?

#

And tried to reset the project settings and didn't help. And now I just tried to create a new project from scratch and the issue is not present so it appears I screwed something in my project.

glacial lotus
#

hmm, the culprit seems to be my gamestate. But even if I use the default one, "GameState" it works for a few seconds and then both clients lag for seconds repetidely. But I suspect this is a different issue.
Can someone confirm? Does PIE + ListenServer lags as hell in 4.21 with 2+ players? And also any idea why my GameState makes the second player to ignore control, HUD, etc...?

#

ok, I figured out it's my stuff not the the editor.

strong abyss
#

hi! I have a FPS multiplayer game I am working on. I am working on implementing grenades that you can cook and then throw but am struggling with the fpp and tpp meshes and adding impulses correctly.
Since I have two meshes, neither is the root, and so if I apply an impulse to one of the meshes, the mesh goes flying but the root doesn't. Any ideas how I can apply a force to a USceneComponent that is my root?

copper grove
#

@strong abyss sgpretty sure you need to set a collision sphere as the root, and the meshes children of that (just like you would a projectile) and add the impulse to that sphere...

strong abyss
#

Okay cool I'll try that out. That makes sense. Thank you!

next osprey
#

planetside 2 has some interesting networking stuff

#

95% of it is clientside, but when you get within distance of other people the server sends as little data as possible

#

it also disables sanity checks as the map isnt really loaded on the server

#

so lag compensation will make it look like people are warping through the floors

#

even if they're not

#

its how they manage 2400 players on one server

#

which is a few more than fortnite

#

they also have some really entertaining bugs like when the tank barrels went floppy for some reason

fleet bear
#

Are there any cross platform examples anywhere? I'm working on a cross platform game and I want to know how I should set it up and if I can get different builds/configurations to run together on a network.

Example being a mobile version with scalable graphics and a pc version being max visuals. Different controls, different UI, even possibly different actors, but probably the same or similar player controller.

How should I be approaching cross play?

wary willow
#

@fleet bear not really mp topic

#

but, you should start with device profiles

#

cvars

#

As for the "networking side", well, good luck with that

fleet bear
#

its def a multi topic. I'm pretty sure that the rendering options don't matter on two builds. It's more the cross platform multi I'm curious about

#

honestly

#

if someone can get me to the point where I press a button and the result shows up on all the devices in the lobby then thats enough for me to roll with

wary willow
#

lol

#

But anyway

#

Look at Tappy Chicken

fleet bear
#

I saw that but it runs through a web interface

wary willow
#

They have Android and iOS setup

#

😃

#

Yeah, like I said

#

There's no "ez button" for cross platform

#

(well I never said)

#

The only "ez way" AFAIK...and I don't like recommending because I don't agree with their current pricing model

fleet bear
#

no but there has to be some general direction as it was plainly stated 4.20 aimed at making it more accessible

wary willow
#

Is SpatialOS

#

Either that, or actually, GameSparks

#

Their Live Service

fleet bear
#

gamesparks is kind of eh

wary willow
#

Either way, you are going to need to deploy to dedicated servers

fleet bear
#

why do you think that

wary willow
#

AFAIK at least

#

I don't have to think

#

Everytime someone asks and I look

#

No information has changed

#

Since I am generally curious for future projects

fleet bear
#

that doesn't seem right. I should be able to be the host and have people connect to me

wary willow
#

Ah, so you mean Direct IP?

fleet bear
#

sure

#

game is quite small

wary willow
#

The issue is how you're going to do the backend networking 😉

fleet bear
#

it's kind of a party game

wary willow
#

Are you planning on creating your own custom subsystem?

fleet bear
#

if I have to

wary willow
#

k

fleet bear
#

would prefer not to

wary willow
#

Actually, I think @jolly siren was recently looking into this?

#

I don't think you understand how much is involved

fleet bear
#

i don't think you understand how small the game is...

wary willow
#

lol

fleet bear
#

joystick, one button

wary willow
#

Size of a game has nothing to do with the amount of work one needs to accomplish to complete said features

fleet bear
#

x and y value of player, do attack button

wary willow
#

Anyway, I listed the only two "ez buttons" that I know

#

Maybe PlayFab has one

fleet bear
#

can I not just do simple tcp stuff

wary willow
#

Yeah, they do

#

So 3

jolly siren
#

👀

fleet bear
#

hello

wary willow
#

Good thing there's a search button on Discord

#

@solar flower You think you can go over your recent attempts (and success) at cross-platform p2p ?

fleet bear
#

ok, so what is fortnite doing for crossplatform that I currently don't have access to?

wary willow
#

lol

#

Forknife is doing...

#

100mil / day

#

With 50+ engineers

fleet bear
#

can we keep this to an intellectual discussion and not snarky comments

wary willow
#

?

fleet bear
#

I'm going to accomplish my goal, I just need to find what direction to start heading in

wary willow
#

That is very intellectual

#

I've given you plenty to start on

fleet bear
#

telling me they make bookoo money doesn't answer my tech question

wary willow
#

Also, just doing some research

fleet bear
#

are they using dedicated servers for example

wary willow
#

Of course they are

fleet bear
#

ok, well thats not the approach I need

wary willow
#

One 2 min research could have told you that

bitter oriole
#

@fleet bear Do you want cross platform, or cross platform MP ?

fleet bear
#

both

bitter oriole
#

You're aware this is immensely hard right ?

fleet bear
#

shouldn't be

wary willow
#

heh

#

I know you wish it not to be

fleet bear
#

there isn't a reason that this should be difficult

wary willow
#

And, I think we all do

#

But, it just how it is man

bitter oriole
#

@fleet bear You don't control the timing of updates on all platforms, to start with

fleet bear
#

ok, well assume I don't care about that for the time being. I just need a place to start

bitter oriole
#

Cross platform is hard because of such questions

#

You should think about it now

wary willow
#

How many engineers do you have on your team @fleet bear

#

?

fleet bear
#

me

bitter oriole
#

Cross platform is not an UE4 problem, it's a process problem

#

UE4 has everything you need

wary willow
#

When do you realistically expect to launch your game ?

fleet bear
#

when It's playable

wary willow
#

or want

#

So, time's not a factor

fleet bear
#

nothing is a factor

wary willow
#

You are going to need to do a lot of backend research then

fleet bear
#

sure

wary willow
#

Includes engine source

#

Sadly we don't have Paragon source

#

Probably never will

#

We'll def not ever get Fortnite

#

AFAIk, those are the only two multiplayer MP games they've done

fleet bear
#

unreal tournament isn't cross?

bitter oriole
#

Cross with what ?

#

It's PC only

wary willow
#

Is it on consoles?

fleet bear
#

i thought it was

wary willow
#

Yeah, thought it was PC only

fleet bear
#

hmm

#

ark

wary willow
#

lol

#

Go ask the Ark devs then

fleet bear
#

pubg

bitter oriole
#

Does Ark have crossplay ?

fleet bear
#

it's on multiple platforms

bitter oriole
#

Cross platform != cross play

wary willow
#

CrossPlatform and CrossPlay are different though

bitter oriole
#

Cross play is way harder

#

WAY WAY WAY harder

wary willow
#

CrossPlatform = Setting up builds for different platforms

#

CrossPlay = having PC and Consoles playing together in same map/game

bitter oriole
#

Cross platform is trivial tbh, you just need different default settings

wary willow
#

Aye

fleet bear
#

yes, aware of this. I was under the impression ark was cross multi. I could be wrong, i don't play ark

bitter oriole
#

Cross play is getting your legal team on visioconference for days with every platform seller

#

And pay $$$$

#

And develop a huge MP backend

#

And get Apple to release your updates on your time

fleet bear
#

or

#

I can say fuck companies like apple and sony and keep moving forward

bitter oriole
#

And Google

fleet bear
#

google is pretty good about stuff

bitter oriole
#

Here's my advice

#

Do it step by step

#

First make a PC game

#

Then a console game

#

Then try to have crossplay

fleet bear
#

the point of the game is the crossplay

bitter oriole
#

Then your game is doomed

fleet bear
#

it's vr vs non vr

wary willow
#

?

fleet bear
#

ok so I'll walk you through the game

#

it's called dungeon master and it plays like castle must be mine for the VR player and they are facing the hero characters played by non VR either mouse and keyboard, console, or mobile.

#

essentially it kind of ends up being something like clash royal in a way

#

sort of

#

so vr player plays like this

#

as the dungeon master

bitter oriole
#

So get it working on PC first

fleet bear
#

and they don't directly interact with the other players, they just manage cool downs and set up traps and stuff

#

mostly there already

bitter oriole
#

Finish your game on PC, ship it on PC, get feedback on PC

#

Then try porting it

#

When you're doing the porting you can think about crossplay

fleet bear
#

that makes me back step a lot does it not

bitter oriole
#

Anyway I'm not arguing all day so short version : crossplay is 100x harder than it's worth as an indie

#

It actually has negative value as an indie because of PC hackers

fleet bear
#

it's not an argument, I'm just trying to get info back and forth quickly without all the extra bloat

#

it's a party game, why do I care what hackers are doing

#

ALSO, wait doesn't rocket league also do cross platform multi? are they using dedicated stuff?

bitter oriole
#

You'll need your own servers anyway

fleet bear
#

fuck it, guess i need servers

bitter oriole
#

You might no need dedicated but at least matchmaking servers

fleet bear
#

can't I just use steam

bitter oriole
#

Sure, on PC

fleet bear
#

mmm theres another matchmaking service

bitter oriole
#

But you want crossplay

fleet bear
#

what was it, i used it before

bitter oriole
#

GameSpy ?

fleet bear
#

mmm no I think It was just online subsystem honestly.

bitter oriole
#

Anyway your problem is connecting Steam accounts with Google accounts

fleet bear
#

actually no

#

i will have my own account system

#

if I'm going the server route anyway

bitter oriole
#

So you'll have players create an account in your game like Fortnite does

#

Create your own matchmaking

#

Handle GDPR etc

fleet bear
#

define gdpr

bitter oriole
#

Google it

fleet bear
#

he General Data Protection Regulation 2016/679 is a regulation in EU law on data protection and privacy for all individuals within the European Union and the European Economic Area. It also addresses the export of personal data outside the EU and EEA areas. Wikipedia

solar flower
#

@wary willow I'm trying to implement crossplay by creating a server list using nodejs, express, mariaDB, and AWS. Then registering and connecting using that. My biggest hurdle is probing the host's NAT, which I'm looking into doing by piggybacking off Steam's port. If i can't break through the NAT, I'll just fall back to dedicated servers.

fleet bear
#

@solar flower interesting. and what kind of game are you making

sharp pagoda
#

@solar flower You're much better off implementing STUN protocol, or ICE if you need symmetric NAT support.

solar flower
#

It's an easy real-time tower defense. Mostly a confidence booster for my team

#

@sharp pagoda I'll look into those

sharp pagoda
#

So just write a simple stun server.

solar flower
#

What's symmetrical NAT?

sharp pagoda
#

I have one on my github I wrote for a p2p game of snake I made

fleet sluice
#

@solar flower Steam's NAT traversal library is pretty robust and reliable. I agree with Xenonic above (ideally, you would have your own, platform-agnostic STUN/TURN/ICE), if you can't do that easily, best to just lean in and use Steam.

fleet bear
#

@solar flower then we have similar projects

solar flower
#

I can't use steam for crossplay

fleet sluice
#

Symmetrical NAT means you're screwed. Connection needs a TURN server hence lots of bandwidth.

#

I.e. corporate firewalls

#

In short, it means you won't receive my packets unless you send some to me first.

solar flower
#

Yea, if neither can send packets without receiving first, that sounds like a shit show

sharp pagoda
#

That's how NAT works? If you want p2p, that's what you have to workaround, which is why STUN exists.

solar flower
#

Why wouldn't it be done similar to public/private key encryption?

sharp pagoda
#

You have to send data outwards to open a port in your nat.

solar flower
#

Ah, gotcha

limpid notch
#

can you call server function from a client?

sharp pagoda
#

Essentially all you need to do (and in your case you should do) is to write a simple server that listens for incoming connections, and when it receives two connections from different addresses send each connection the public details of the other. This way you're making two clients that want to play together aware of the connection details to each other.

fleet bear
#

interesting

#

hmm

#

what if he built his game in html5?

#

would that simplify his crossplay situation

limpid notch
#

can you call server function from a client?

fleet bear
#

i think you can request a call of the function from the client

sharp pagoda
#

Look at the chart

limpid notch
#

then why the fuck when I call a server function from a client it is not executed? I've put prints before and after the function is called and a print right at the start of the function and the one inside the function is not printed , meaning its not entering there

fleet bear
#

yeah no that won't work

#

thats not what I said

sharp pagoda
#

You're in one of the Server dropped cases

#

So you know it's either owned by someone else, is a server owned actor, or isn't owned at all.

fleet bear
#

gamesparks cross platform play

solar flower
#

Any reason I can't set the owner of an Actor to be the client right before calling a server RPC in order to not have it dropped?

thin stratus
#

@solar flower Well SetOwner has to happen on the server

solar flower
#

ah, well that explains that

thin stratus
#

A serverowned actor is unreachable for rpcs

#

You gotta rpc earlier

solar flower
#

This is what I was trying to do...

#

This would all be called on a server owned actor

#

So there's no way to rpc on a server-owned actor?

thin stratus
#

Your code doesn't make much sense

solar flower
#

Right, ResourceTransaction wouldn't need to be an rpc, and MiningTransaction will be dropped for clients

thin stratus
#
  1. SetOwner has to happen on the Server
  2. Server and ClientRPC don't work on a Server owned Actor
#

Means, HandleMineRock already needs to be on the Server

#

How is HandleMineRock called?

solar flower
#

Called from an ActorComponent on the client owned Character

thin stratus
#

What's the chain of events then?

#

Where does is start

#

Probably a KeyPress?

solar flower
#
  1. Character BP gets Input, calls function on ActorComponent
  2. ActorComponent calls HandleMineRock every x seconds
thin stratus
#

Alright then you need to place the ServerRPC somewhere between the Input and HandleMineRock

#

So either when you get the Input->ServerRPC->Function in ActorComp

#

Or Input->FunctionInActorComp->ServerRPC

#

Or Input->FunctionInActorComp(As ServerRPC)

#

And from there you call the HandleMineRock

#

You can call HandleMineRock on the Client in addition in case you wish to do some FX stuff

#

But then you gotta filter the call with SwitchHasAuthority

#

So you can split what the server does and what the client does

solar flower
#

Can you call server RPCs in an ActorComponent?

winged badger
#

as long as the Actor's NetOwner is the PC, yes

thin stratus
#

Since you say the ActorComp is on the Character

#

Then yeah

#

Character is possessed and owned by the PC

#

So the Comp is basically too

#

Gotta mark it as Replicated though

solar flower
#

Ah, that's what I missed before

winged badger
#

if you do GetOwner() until you run out of owners

#

and the last one is the PlayerController

solar flower
winged badger
#

then Actor or Component can do a Server RPC

thin stratus
#

You know

#

You could also just pass the Class

#

Instead of making so many different RPCS :D

#

At least for the ones that works the same

solar flower
#

I couldn't find a way to expose the variables I wanted on spawn for each

#

Because i'd have to cast to set the class-specific parameters

#

Appreciate the help with HandleMineRock

thin stratus
#

Welp, Inheritance

solar flower
#

Gonna try the server rpc in the ActorComponent

thin stratus
#

Alright!

solar flower
#

Since it's replicating I just set the RockDeposit in the server RPC to avoid all the wires

thin stratus
#

Might be wiser to just set a variable instead of that ClientRPC

#

A Replicated one is totally enough

solar flower
#

@thin stratus Set it for the RockDeposit?

thin stratus
solar flower
#

You know about snipping tool?

#

And I see, i'll look into it

thin stratus
#

Yeah, why would I use the snipping tool?

#

ShareX instantly uploads for me

#
  • supports gifs :P
solar flower
#

Oh that sounds pretty dope

#

Guess you'd use it if you didn't know about ShareX

sharp pagoda
#

Win + shift + S is much faster then any webservice imo

thin stratus
#

@sharp pagoda I don't have to wait on the upload though

#

It's fast enough

sharp pagoda
#

Oh so it saves the buffer to clipboard and publishes it on their server?

thin stratus
#

Yeah, but I can also just paste it

#

And then it uploads here

#

Depends on the chat you use

sharp pagoda
#

Neat

hardy ferry
#

Quick question for you friends.
When Playing In Editor, and checking the "Run as Dedicated Server"
Is any latency in that something that might correlate to a compiled build having latency?

fossil spoke
#

You shouldnt have any latency in PIE

#

Unless you have set latency yourself via the Net family of console commands.

burnt blade
#

In your guys' opinion, what is the best way to have persistent player state in an online game? How would I go about storing PlayerState for an indefinite time until they reconnect or server is wiped?

#

And say a player has a place to store items separate from their character. Where should this be stored? GameState? PlayerState? Maybe somewhere else entirely?

#

So far I have my ReplicationGraph for my "game" working, and Players are able to pick up items and equip/keep them in inventory

#

but when they log out is the PlayerState saved until the server is shut down?

#

I'm not very aware of whats happening behind the scenes

hardy ferry
#

@fossil spoke That would be something I have to manually set? Because I consistently get latency (in 4.19) and I don't remember setting anything

fossil spoke
#

What do you mean by Latency though.

hardy ferry
#

I could be wrong about it being network simulated performance issues, but when I do normal PIE I run the game fine, then when I simulate it as a client, the client version always seems to have performance issues that the window marked server does not

#

this may be a hasty guess, but my assumption is that this is a latency issue as the only thing seemingly being changed is the "Run As Dedicated Server" box, or that the other window is a client window

#

(sorry for that long initial reply)

fossil spoke
#

You need to describe exactly what is happening that isnt happening properly. Just saying you think something is latency doesnt help at all.

#

What exactly isnt working.

#

All you have said is that you think you have latency....

#

That doesnt help me help you man.

hardy ferry
#

Sorry, my bad

#

One specific issue is that when I'm firing my weapons, my UI counters don't update in the frequency that they should, and the sound wont play as quickly as it should, like sometimes it delays playing the sound, or will seemingly not play a number of the sounds

fossil spoke
#

Ok great we have something to work with.

#

How are these things being triggered on the Client? Via an Multicast RPC or variable Replication?

hardy ferry
#

Multicast RPC

#

the UI is a simple binding to an int that is set to be cond -> owner only

#

this is also all in Blueprints, if that makes much of a difference.

#

(I'm also not spawning in thousands of actors, I have about 20 ai in my scene, most other actors (340 total) are static geo)

#

I wish I'd been able to find more answers online, but google wasn't quite helping

fossil spoke
#

So the issue im going to assume is that your not getting the Clients to play cosmetic events locally when they perform an given action.

#

Your waiting for the Server to confirm that action before playing cosmetic events.

#

Take this image for example

#

Client fires their weapon. Sends that information to the Server.

#

The Server confirms and fires the weapon, but then tells each client to Play those Effects.

#

For other clients that wasnt the person who actually fired the weapon this is ok since they cant predict that event in any way so they must wait for the Server to let them know that happened.

#

This is how im assuming your doing all your stuff right now.

#

What you want to do instead. Is have the local client (the one that fired the weapon) Play all of the cosmetic stuff when they fire the weapon, you would check if they can fire the weapon and all that jazz and also let the server know that they want the weapon to be fired (so that the Server can confirm this action and perform the necessary operations to make it happen for everyone else and to update the state of the game if anything happened because of that weapon being fired IE: damage something)

#

This means that the Player who fired the weapon will get instant feedback and thus to some degree mask the fact that latency exists.

hardy ferry
#

I think I'm mostly doing this.
Firing happens on the server, run through checks to make sure I can, then firing logic, but then I'm spawning the bullets (actors, not raycast) and then I'm doing the effects.
Maybe part of the issue is also the significant amount of network replicated actors being instantiated? I'm not using pooling atm

fossil spoke
#

and then I'm doing the effects

If this is being done on the Server then the Client that fired the weapon wont get those effects until the RTT (Round Trip Time)

#

You need to Fire the Weapon on both the Local Client and the Server so that the Local Client (the player that fired the Weapon) can play the effects immediately and not have to wait for the Server.

#

This isnt just for playing effects, things like updating the UI that displays the current ammo etc etc is also important.

hardy ferry
#

So the client should also still be responsible for their own conditionals as to whether or not they can actually fire?

fossil spoke
#

Yes, for cosmetic purposes.

burnt blade
#

^

#

You firing on your screen is fake

#

But is confirmed later on after you see it

hardy ferry
#

okay, I understand

fossil spoke
#

The Server has the final say and does the important things such as applying damage to other players or entities.

#

The Client might still do that locally again for cosmetic reasons but the Client would never update the state of the game.

#

Watch this GDC talk. It will help explain as well if you have the time.

hardy ferry
#

I'll definitely make time for it, I've honestly been meaning to watch this one for a while

fossil spoke
#

Its not easy to wrap your head around immediately but once you get it, it will all make sense.

hardy ferry
#

Yeah, I've been trying to do this for a while now, but I'm a designer, not a programmer xD replication is... fun

fossil spoke
#

Its not a small topic.

hardy ferry
#

Thanks for the advice!

fossil spoke
#

👍

winter plover
#

netcode is really half designing anyway really

#

the actual programming of it in unreal isn't particularly difficult

#

also yea that gdc vid is pretty damn valuable

brittle slate
#

I’m trying to set a projectile owner it sets fine on server but not client I can’t figure out why. Any suggestions?

winter plover
#

Im assuming you set it as replicated already right?

brittle slate
#

Yeah

winter plover
#

k just excluding the trivial

#

How and when do you spawn the projectile?

brittle slate
#

I have a master weapon which spawns it

#

It sets the player character to the owner of the projectile when spawning it.

winter plover
#

oh this might be important too, are you running a listen server?

brittle slate
#

It works fine if I have a server and client but if I just run dedicated server it doesn’t work

#

The projectile damages the client

winter plover
#

Do you have some code around the spawning of the projectile?

#

or a screencap of the BP?

brittle slate
#

Um 1 sec

#

I do not but these are the errors I get.

winter plover
#

what do you mean you dont?

brittle slate
#

I’m on my phone, don’t have a screenshot on here haha

#

1 min

winter plover
#

ahh okay fair enough :v

bitter oriole
#

@winged badger So, it's the quaternion.

winged badger
#

not initialized?

bitter oriole
#

Oh no, it's initialized allright, it's normalized and all

#

But using a quat crashes the engine inside the rep code

#

FRotator works fine

winged badger
#

sigh

bitter oriole
#

¯_(ツ)_/¯

winged badger
#

with the same nonsense error you get when trying to replicate TMap, i'd wager

bitter oriole
#

I wish

#

It just simply crashes

winged badger
#

it would be routed into a function that doesn't do anything but crash

#

by design

bitter oriole
#

Amazing

#

Now I hope I'm not getting gimbal locking with this shit

winged badger
#

as long as you only transfer rotators, but don't do any math with them

#

you'll be fine

bitter oriole
#

I guess so, though I treat FRotator as a problem waiting to happen

bold heron
#

I'm getting some fairly nasty spikes on my Game thread. It seems to be caused by Net Tick Time Anyone know of a way to dig deeper into what might be causing these spikes?

burnt blade
#

What are the best solutions for storing persistent player data between sessions?

#

Ie something like player level/skill tree in an mmo

bold heron
#

if it's going to last between game session I'd write it to a database.

burnt blade
#

Is this something that kind of goes on outside of unreal?

#

So I'd keep a server running independently as a database?

bold heron
#

yeah. You would want a server for the game and read data (we use JSON strings) from an external database. That way you can spin up or down game servers to handle load and a player could join any individual server.

burnt blade
#

Is serialization built into UE4 in any way?

bold heron
#

Yeah there are a few ways to serialize data into different formats and compress it.

burnt blade
#

Alright I'll look into it thanks

hasty adder
#

That's a pretty regular heart beat of spikes

bold heron
#

Yep. I figured it had something to do with the update frequency.

#

Not sure what it is but manually handling dormancy seems to solve the issue it's just extra work 😦

bold heron
#

humm I can't seem to access a Set Net Dormancy blueprint node. Is that not in 4.17.2?

twin juniper
#

GameSession->KickPlayer(PC, FText::FromString("Victory/Loss."));

#

Is there a way to "Kickplayer()" to the main menu

jolly siren
#

@twin juniper ClientReturnToMainMenuWithTextReason

twin juniper
#

ok

#

Then we just override ClientReturnToMainMenuWithTextReason(const FText& ReturnReason); ?

jolly siren
#

if you need custom behavior

twin juniper
#

By default, it does nothing with the FText that you pass.

#

It just passes it, but does nothing with it.

#
{
    if (UGameInstance* const GameInstance = GetGameInstance())
    {
        GameInstance->ReturnToMainMenu();
    }
    else
    {
        UWorld* const World = GetWorld();
        GEngine->HandleDisconnect(World, World->GetNetDriver());
    }
}```
jolly siren
#

Right, yeah you can just override if you want to do something with it

twin juniper
#

It does nothing with it, very strange!

jolly siren
#

like display that you have been kicked

winter plover
#

iirc there's a logic reason

#

with onrep, you are guaranteed to receive an update eventually when it becomes relevant

#

an NMC RPC fires once, and if that particular actor is out of range, it wont receive the update

twin juniper
#

@jolly siren ``` Super::ClientReturnToMainMenuWithTextReason(ReturnReason);

winter plover
#

so it's generally preferable to have status updates tied to replication

twin juniper
#

Can I call this inside of the _Implementation function?

winter plover
#

NMC can still be used for oneoff stuff like FX

jolly siren
#

@twin juniper Super::ClientReturnToMainMenuWithTextReason_Implementation(ReturnReason);

twin juniper
#

So, we only call the non _Implementation version when we are calling the function itself?

jolly siren
#

yes

winter plover
#

maybe it used to be used for more

#

but got reduced

#

and it was just not worth the effort to change it into an RPC

#

dunno

#

shootergame is probably smallscale enough where it doesnt matter too much

#

not that I know of really

#

at the end of the day, all it does is send a packet with arguments to the recipients to call a function

#

it weighs about as much as any arguments you give it

#

so technically an RPC can take up more bandwidth than replicating a single variable

#

but generally it's fine if you just pass the arguments you absolutely need to get the desired effect

jolly siren
#

Where is the best place to do something clientside when a player quits? For some reason UnregisterPlayerWithSession isn't called for the quitting client. It's called for the server and other clients, but not the client doing the actual quitting.

#

It's called from APlayerState::Destroyed so I find that strange

rose egret
#

is there any way to be sure on client side that a RPC is received before replications?
I don't know what to ask exactly . I want to implement something like TiledPosition so that the tile index of actor is synced between clients and server ever 5 seconds. and position is replicated based on tile index instead of a full FVector

winter plover
#

is there any reason it has to be replicated exactly every five seconds?

#

Why not use OnRep for that, sounds like it would be suitable for this

rose egret
#

I have to sync an byte index between client and server. server sends position by replication based on index A and client must calculate the position based index A.
if client receive position data before receiving the index A I get into trouble.

#

btw surely I don't want to send index along with position everytime 😉

winter plover
#

why not omit replicating the position then? Seems pointless if it's derived from tile indices anyway

#

also actually why not

#

you could pack them in a struct and keep sending them together

#

consistency > bandwidth

#

iirc even when packing them in a struct, only the components that change actually get sent

#

so it shouldnt actually be that much more data being sent

#

assuming that you have more position updates per tile updates

rose egret
#

I want to decrease the bandwidth . instead of packing them I could just send the world space position.

winter plover
#

is it a turnbased game you are working on?

#

or does it have to be real time?

rose egret
#

its real time and I have more position to be updated.

#

nearly 120 unit

winter plover
#

mhmm I see

rose egret
#

😬

winter plover
#

well the only thing I see to decrease bandwidth is omitting the world position really, because I imagine the tile index is what's actually relevant for gameplay

#

or maybe use less precise vectors

#

if you do world space updates, you might get very choppy updates anyway with 100+ units

#

if you just have tile indices, you can just interpolate clientside

rose egret
#

actually I previously changed the transform replication and wrote my own and saved a little bandwidth. but I was thinking about this TiledPosition idea which is helpful for big world too.

winter plover
#

like with 120 units I dont think you can really accurately keep worldspace in sync all the time

#

because it's basically constantly changing while a unit is on the move

#

with tile only updates, it's only once per every new tile they reach

#

that's probably gonna be alot less data overall

#

does all your gameplay code use tiles for reference?

#

say when you wanna attack a unit

#

do you tell the server to attack a specific tile or do you send a pointer to the actor you want to target?

#

because if you do the latter, you can probably easily afford slight inaccuracies

#

anyhoo, I gotta run for now, brb in 30 minutes

rose egret
#

no I think u got it wrong.
instead of sending a Vec3 position for world position every time. I want to sent position relative to the synced tile index between client and server.which 10 bits per component is enough.

#

ok I am gonna go home its night 😃

cosmic yoke
#

hello guys, lets say i regular empty actor and i want to call rpc's on it, right now the only way i know how to do that in blueprints is to use an actor that has a valid netconnection, like the player and use it as a proxy. so in Actor A i call an rpc on the Player and do some stuff there. Is there a way to dont use the player at all and just do rpcs on Actor A?

winged badger
#

if you're doing something complex, as having a world item with its own logic and UI

#

you can have it add an ActorComponent containing all required logic to the Player when he/she interacts with the Object

#

replicated ofc

#

and ActorComponents are good for encapsulating related networking code, especially in BP, they can send the RPC just as well

#

for doing it from Actor A you would have to set its Owner via SetOwner on server to your PC

#

there is no other way

#

well, Attaching it to PlayerPawn or PC or PS would also work, but only because that would set its Owner to your PC (also needs to be done server-side)

#

(indirectly set Owner, as the owner would be PlayerPawn whose Owner is the PC, and that is just fine)

jolly siren
#

Is there anyway to call a function on the client when it disconnects/quits/exits the program? APlayerController::Destroyed only looks to get hit when quitting to the main menu (not when exiting the program all together). And APlayerState::Destroyed isn't getting hit on the quitting client for any of the above scenarios.

APlayerController::Destroy and UGameEngine::PreExit might work. But seems like there should be an easier way 🤔

winged badger
#

Maybe one of the GI notify events would do

#

i don't know if disconnect is a NetworkError, but EventHandleNetworkError might just cover it

#

any of quit/exit/dc would also require closing a current map

jolly siren
#

Yeah I was looking at EventHandleNetworkError. It does look like connection lost and connection timeout are network errors

winged badger
#

I don't know if manually quitting is though

jolly siren
#

Oh other caveat is that I don't want to call when travelling

winged badger
#

maybe FWorldDelegates have something for you

#

there should be separate broadcasts for OpenLevel and SeamlessTravel

#

or ClientTravel

#

and i believe those are all virtual as well, so you could even hook your own delegate there

jolly siren
#

Kind of weird that GameInstance::HandleNetworkError is a BlueprintImplementableEvent

#

Now I have to override UGameEngine::HandleNetworkFailure_NotifyGameInstance instead

#

ah I can bind to OnNetworkFailure nvm

swift topaz
#

If you've

ActorRef->SetNetDormancy(DORM_Initial);

What's the appropriate way to wake up the dormant actor for destruction?

ActorRef->SetNetDormancy(DORM_Awake);
GetWorld()->DestroyActor(ActorRef, true);

doesn't seem to do it.

subtle peak
#

Hey is it ok to handle weapon reloading client-side or should that happen server-side?

winter plover
#

the actual ammo count should be updated serverside

#

but you can client-predict the animation

hardy ferry
#

Hey, maybe dumb question.
Is it more expensive to the network to have a replicated variable or to have an RPC function call?

winged badger
#

a variable shares the overhead with other variables on the same Actor

#

iirc RPCs do not, but i am not 100% on that

next warren
#

During matchmaking how can i get gamemodes from list of session result.. for auto joining to session based on gamemodes we select in main menu

#

Deathmatch or ctf mode

next warren
#

Anybody help...thx in advance..

slim holly
#

something something config string

#

or if you only need the game mode, you could just add it as a prefix to host name

#

and sort the session list using that

sharp pagoda
#

@next warren FOnlineSessionSettings is the class you're looking for, you can add any key value pair you want in there, including the game mode name.

rare cloud
#

Greetings, just to confirm if this is valid : "open 127.0.0.1?Name=MyPlayerName"

#

I execute this command and each time my name is MyComputerName-UUID

swift topaz
#

Are you using an OnlineSubsystem? If you are, setting it that way won't work.

rare cloud
#

I don't use one normally