#multiplayer

1 messages Β· Page 599 of 1

ember needle
#

and I can encounter potential crap along the way

#

never spawned manually, i normally put all my logic in FindPlayerStart and GetDefaultPawnClassForController

#

(BP)

winged badger
#

HandleStartingNewPlayer calls GetDefaultPawnClassForController

#

by default

ember needle
#

just for the sake of learning

#

how would manual spawning look like

winged badger
#

basically

ember needle
#

and again thank you.

winged badger
#

if you override HandleStartingNewPlayer and add call to Parent function and connect it

#

you are at the point where you have (for the first time) valid PlayerController, PlayerState and PlayerPawn, which is Possessed at this point

#

spawning manually would omit the Parent function call

#

have you spawn Pawn via SpawnActor at FindPlayerStart transform, then Possessing it (PC provided as input on the event)

ember needle
#

ok again to learn :)

what if I just set None to default Character, then when server has loaded the streams manually spawn and possess them?

winged badger
#

you can do that

#

HandleStartingNewPlayer is a natural hook for that

ember needle
#

to manual spawn you mean

winged badger
#

as it would be called only after server has finished loading streaming levels

#

in this setup

ember needle
#

what would I have to do to make this happen?

  • set default character to None
  • manually spawn in the HandleStartingNewPlayer call
#

but how can I ensure that the server has loaded the streaming levels?

winged badger
#

you already did

#

you prevented server from calling HandleSeamlessTravelPlayer

#

HandleSeamlessTravelPlayer calls HandleStartingNewPlayer

ember needle
#

ah so this needs bits of the previous setup

winged badger
#

bonus with HandleStartingNewPlayer

ember needle
#

wait wait πŸ˜„

winged badger
#

is that its also called from PostLogin

#

so it handles late joiners as well

ember needle
#

so for this last option of manually spawning after setting default character to none

#

what of the previous overrides do I need to keep

mild trout
#

Hello, any specific reason for my player states's property showing up as null or zero on the clients?
It is set a replicated

kindred widget
#

What kind of property is it?

mild trout
#

at first was a Character but I found out it doesn't work with floats either

#

Wanted to store the reference to the character in the world that a player is in control. like a moba character

thin stratus
#

PlayerState already has that, but only in C++

mild trout
#

on my current framework, the player pawn is actually a camera pawn that follows the controlled character

kindred widget
#

You're certain you're setting it only on the server?

mild trout
#

ah good call. was using Init Start Spot to spawn the character and assign it to the player state

#

maybe is client side only

#

being on game mode, is on the server. just checked

#

ah found the issue!
was using GetPlayerController to get the player state on that function in the game mode

#

my bad πŸ˜„

kindred widget
#

Haha, happens. I do definitely avoid that function when not dealing with client only stuff like getting the HUD for that client or whatever.

lost inlet
mild trout
#

why is that? I want to have the player camera separate from the actual character

#

how would you do it?

lost inlet
#

subclass the player camera manager and write your camera code there?

#

the normal UE4 way is to possess the character you're actively controlling, not some separate camera actor

#

and is the camera actor something you actually have to have network relevant?

mild trout
#

ah good call on the camera manager. I'm going to check that one out

#

no, the player camera isnt replicated

lost inlet
#

yeah, even more bad stuff then

#

even if you have a separate actor, the thing you should possess is the character

ember needle
#

^

mild trout
#

but I want to have it working kinda like in an RTS

ember needle
#

what are you trying to achieve?

#

if you mean rotating the camera around the player and such, you definitely don’t need to reinvent the wheel

mild trout
#

I want to have multiple hero characters that are controlled by AI or by a player
the player acts as a god or spectator in the game, taking "control"/giving orders of a given hero

#

and the camera just moves around the map like in a RTS or follows the current selected character

kindred widget
#

Well, for like an RTS a separate CameraPawn is perfectly fine. Specially if you need like Behavior trees for the character.

twin juniper
#

help, my movement speed seems to be directly proportional to my number of players kappaross

#

empirically guessing

winged badger
#

that is actually the very first time i heard that one πŸ˜„

twin juniper
#

I mean I could just divide by number of players but not sure so robust...

winged badger
#

now time to stop adding X to speed of GetPlayerCharacter[0]

#

which is what im assuming you did

#

other possible causes: not accounting BeginPlay, Tick and Overlaps run for every character on every machine

twin juniper
#

idk Im using projectile movement so I thought it might be some complicated physics stuff to do with time stepping

winged badger
#

to achieve that you have to be adding some float to current max speed somewhere

#

or some vector to projectile movements velocity

twin juniper
#

Yes

winged badger
#

your bug is there

twin juniper
winged badger
#

i don't seew what goes into velocity pin

twin juniper
#

that float (multiple of three) multiplied by actor forward

winged badger
#

that is unusual, since it doesn't technically accelerate, it just overwrites velocity vector

#

hows float velocity set?

twin juniper
#

you mean the projectile movement settings?

winged badger
#

the one visible on top screen

twin juniper
#

200000

#

its fixed

winged badger
#

doesn't seem to be number of players related

#

unless you're doing PIE and your FPS drops

#

because that speed is framerate dependent, the worse your performance the faster it goes

twin juniper
#

yeah but its not linear like

#

I have 6 players vs 3

#

my fps drops from 30 to 25

#

but the characters move 2x as fast

#

and I am multiplying by time scale

tidal crown
#

is Execute Console Command BP node of the "servertravel" command going to be blocking? EG, can I use the exit pin to do something after the travel/level load is successful?

regal sand
#

What is the best way to test a dedicated server locally? I heard of something called "cloned client" or something like that, to test it. I need to test a game session; before I can start using AWS

sly violet
#

Hey all, learning how to do seamless travel. I am missing a basic understanding of how to return or execute a function after server travel is complete. Really, when Streaming is complete in the next level.

After this:

winged badger
#

@tidal crown no, it will execute synchronously right after you init travel

#

@sly violet fine control over seamless travel usually requires c++

#

but BP can usually gimmick something up

#

depending what you need really

tidal crown
#

I went hunting and found OnPostTravel could be overridden from C++ so I just tacked a multicast delegate to it.

winged badger
#

PostSeamlessTravel you mean?

tidal crown
#

yeah that one πŸ˜›

#

its funny how much of this stuff i really want in BPs that they just kinda leave to myself

winged badger
#

there are some things they didn't expose but really should had

#

on the other hand, there are few things they exposed that is just insane to expose to BP

zinc charm
#

I've been experiencing an error I haven't been able to resolve for about a week, after getting into the GameDev.tv course on Unreal Engine 4 networking.
If anyone could provide some insight I'd be grateful. screenshots below.

Basically:

I setup logmein Hamachi computer A, copy the ipv4 address of computer A, then start the server on computer A.
I start LogMeIn Hamachi computer B, Join Computer A's server.
I use this command to join Computer A's game instance"C:\Program Files\Epic Games\UE_4.23\Engine\Binaries\Win64\UE4Editor.exe" "E:\Unreal\LearningUnrealNetworking\NetworkingProj\MyProject3.uproject" {IP} -game -log
copper sand
#

@zinc charm it's not making the connection (timing out), so if they are on the same network (via hamachi), you'll probably need to open the right port. I went through this exercise not long ago.
TL;DR: open up private port 7777 in your windows firewall

#

win key -> firewall -> advanced settings -> right click inbound rules -> new rule -> "Port" -> UDP 7777 -> finish going through that wizard thing

#

sometimes these rules don't immediately take place, so might need to reconnect to your network or restart or something. Not sure why they don't always take place immediately.

zinc charm
#

Thanks a ton dude, i been struggling with this for a week.

#

Imma try it and let you know.

copper sand
#

Yeah you're where I was a few days ago and it took a while to figure out what was going on. Hope it works for you.

glad sedge
#

Do I need to create a dedicated server build to test ded. server connection while I'm debugging stuff ya think?

#

Doing my head in jumping between the server debugging and the 'client' (which is the same stuff, just different builds)

meager spade
#

you can launch a editor version of a dedicated server just fine

#

even in PIE

glad sedge
#

yeah cool. I was just wondering if there was any wildly different behaviour

#

But that's fine.

lucid vault
#

Could not find SuperStruct TestGameMode to create BP_TestGameMode_C

#

This error only occurs after packaging and running my dedicated server (on startup)

lost inlet
#

does your server Target.cs contain the module that has the TestGameMode in it?

lucid vault
#

It does, however, I do notice that my Server target cs looks slightly different than my editor target cs

#

ExtraModuleNames.Add("GameName"); vs ExtraModuleNames.AddRange( new string[] { "GameName" } );

#

The former is the server cs

lost inlet
#

this makes no difference

#

but the class is missing from the server build for sure

#

and you must use a source build to properly build a dedicated server

lucid vault
#

Yeah, I'm using a source build. I guess I will try to re build again and see if that fixes it

peak sentinel
#

Whats the way to make a friend list without Steam? I am working with mobile, so I cant use Steam, and I dont understand what EOS is stands for. I mean, Steam has its own accounts, database etc. Should I make my own account system for EOS?

meager spade
#

EOS has accounts

#

it can use Epic Accounts

peak sentinel
#

Thanks, ignore my 2nd question if you saw it πŸ‘Œ

woeful hound
#

Does anyone have experience or an idea on how to set a UWidgetInteractionComponent's Virtual user index for an online game?

sly violet
lost inlet
#

"does a designer touch it?"

#

and with OSS stuff, a designer wouldn't

#

black boxing is kind of important for us too, since we have a moddable game

glad sedge
#

ugh, I'm an idiot - There's no such thing as a Server HUD.

barren patrol
#

any tips on implementing an RPG inventory "grabbing" item in an authoritative multiplayer setting?

#

do you guys have a "grabbed item" replicated property, or do you use client-side tricks?

#

right now when I pick up the item out of my inventory to equip it, that only happens client side. and I send a "swap items" RPC when the user clicks to place the item

#

i made my life harder by doing a jigsaw style inventory where items can be different sizes

#

this makes it possible to swap a large weapon for a smaller weapon and the large weapon doesn't fit anymore in the inventory

rose egret
#

what happens if I call a Client RPC on AIControlled pawn, I wonder why client get the rpc. it dosent have owner.

chrome quest
#

@barren patrol

I may not be able to answer your question. But please can I ask if your inventory is UMG based or based on "pure" logic.
E.g I also made a jigsaw inventory but the code for mine is in an Actor Component. It also supports containers within containers

#

Most of the tutorials I found were based on Widgets which I didn't like because UMG exists only client side

barren patrol
#

yeah mine is UMG. Personally im fine with it, I have an actor inventory component that manages the data and replication. the UI should just listen for events and call RPCs on that component

chrome quest
#

Oh. I only use widgets to move items within and out of the container.

hollow token
#

anyone familiar with an issue where a struct is not being replicated from server to client?

chrome quest
#

@barren patrol
How I handled replication is to replicate the array of structs holding the item data. Any interactions with the items in the inventory is done using RPCs in the owning actor that in turn call regular functions in the component.
E.g to equip an item from the inventory. I have a RPC in the character that calls an equip item function in the inventory component. The function then handles removing the item from the inventory. I also use the item data to spawn an actor on the server. That attaches itself to the character.
It's sound convoluted but it uses no more than two functions

crystal umbra
#

sequencer vs code and timelines for moving platforms/elevators? THoughts?

modern swift
#

Hi guys anyone know why when we run the dedicated server , sometimes the pc deleted in client automatically , and sometime they not delete it , is that an issue for ue4 4.26

winged badger
#

that would be an excellent one, that has no business being exposed to BP

#

lost more then a day recently tracking down "breaking GC cluster assumption" crashes because someone accidentally ticked that on on one of the BP actor bases

sly violet
#

Wow, no kidding!

winged badger
#

basically, editor does no GC clustering, so it won't break

#

but packaged debug/dev game what happens

#

those actors get added to the root set

#

now, some of our actors inheriting from it could take damage, and the handling for it was done in BP (just a window glass shattering, nothing gameplay critical)

#

which meant it had a PointDamageEvent node, which had a DamageSource pin on it

#

and the way BP pins work, that window kept the reference to the last weapon that damaged it forever

#

but because its in a root set, its not allowed to reference anything outside root set, or it breaks GC cluster assumptions

#

which brings us to the crash

#

so... yeah

#

exposing that to blueprint is positively insane

glad sedge
#

If I do 'ServerTravel' i.e. World->ServerTravel(FString("/Game/Maps/Track2"),false,false);

#

I don't need to tell the Player Controllers to do the OpenLevel on their end too, right?

#

also getting this on my server. LogNet: NotifyAcceptingConnection: Server Lobby refused

#

Basically, my clients aren't changing their maps. It's like the Server has travelled and hasn't taken the clients with em

#

Any ideas would be appreciated.

violet sentinel
halcyon totem
#

is there any way to see what code is not replicating? I am running into issues where my character does the jitters which means something is not replicating correct

bitter oriole
#

No, it doesn't really work like that

#

Character jittering just means something in your network code is wrong

#

Usually it means divergent behaviour between server and client

#

For example, different velocity on both

meager spade
#

or replicating the skeletal mesh when using CMC

modern swift
#

if I have a lot of client connect to the server at the same time, it will remove some of client's pc

#

I using replication graph not sure , is it related to that

fallow shadow
#

hey i am wondering, if i have a quest system that i want to replicate and it has features like accept, decline, abort, track quest, interacting with NPCs and destroying objectives after they have been completed what parts of the above should i replicate?

halcyon totem
#

I dont understand why this is happening but I have an event dispatcher that calls a code thats suppose to open a door but if I have more then 1 door on the map, it only opens door_example if there is a door_example 2 it wont open even though I told it to open what else do I need to do to get the other doors to open?

meager spade
#

@halcyon totem what do you expect to happen when?

twin juniper
#

hi guys, i just upload a gameserver build on the aws gamelift service, and create the fleet, im following a tutorial to setup aws and in the next step the guy crate the queue list and the matchmaking flow, my question is, there is a way to start joining the server from the client? i would like to make join a friend and test some stuff, it is possibile? if yes, can you point me in the right path? thanks

rich ridge
#

@twin juniper do matchmaking session search and join

#

That's it

twin juniper
#

Watch Part 3 here: https://youtu.be/_A4JiDY24gM

This video is the fourth part of an extensive and informative tutorial on how to integrate Amazon GameLift with Unreal Engine, going over concepts such as creating a FlexMatch matchmaking configuration, attaching a matchmaking rule set to the matchmaker, and making an SNS topic for receiving match...

β–Ά Play video
rich ridge
#

Get the IP and port of the dedicated server instance from the fleet and execute command.

open ip:port

twin juniper
#

in the server fleet i put as ip 0.0.0.0/0 and port 7777-7778

#

the ip if you know is getting assigned automatically or i need to request it? cannot find probably the right settings

rich ridge
#

Not fleet execute command at client side

halcyon totem
#

@meager spade the problem I have is that only 1 door opens the first door I put on the map the others won't open

meager spade
#

ofc it does

#

look at your logic.

rich ridge
twin juniper
#

mmm but for ip i should set 0.0.0.0?

rich ridge
#

why?

#

you want to connect to your gamelift fleet or some else's network where your dedicated server doesn't exist?

twin juniper
#

to the gamelift fleet

rich ridge
#

so get the address(IP) of your gamelift fleet.

#

in aws console it should be visible

twin juniper
#

sorry

#

italian

#

1sec

rich ridge
#

@twin juniper don't post publicly

#

delete it

meager spade
#

quick hack it!

#

:/

#

damn

twin juniper
#

lol well i don't have anything on there

meager spade
#

nah its all good

twin juniper
#

is a simple build lol

rich ridge
#

if you don't mind , then post it publicly. πŸ˜…

twin juniper
#

you scare me ahahah yeah i don't have anything and it's the free tier but ok better to not you have right

#

btw cannot find the server ip for some reason

#

address range say just 0.0.0.0/0

rich ridge
#

free tier doesn't mean you won't be charged at all, there are few services which aren't free in free tier, few services have quota in free tier, if quota exceed you will be charged

twin juniper
#

yes i will terminate the fleet or just stop the service once i get connected

#

it is just a test basically

rich ridge
#

i have never worked with gamelift, ideally if you use ec2 instance, if spin one instance you get an IP allocated like 110.56.95.125 and client can connect to that IP

#

and gamelift is no exception to this rule

#

i have given you the idea how to connect. in console you should be able to find the running fleet and its IP

twin juniper
#

ok thanks i will search deep, they hidden probably somewhere and i cannot see it

soft relic
#

Anyone used the enhanced vehicles plugin with replication? Cant seem to get a smooth movement without bumps each second

summer tide
#

Spawn actor needs to be on Multicast right?

#

Only

#

Or there's better way than that

wheat magnet
#

is anim instance class is replicated?

#

or should i need create custom event inside that class to run logic on client side?

lost inlet
#

no

sinful tree
#

@twin juniper You need something to create a player session for you and pass it to the client. For example, I have a Lambda function that I call using a REST call to "log in" which also returns the session details to the client which contains the appropriate IP address of the server.

https://docs.aws.amazon.com/gamelift/latest/apireference/API_CreatePlayerSession.html

lost inlet
#

all the necessary information needed to accurately reproduce animation on the client should be networked via the pawn

lost inlet
mighty zinc
#

I'm using newobject to make an object inheriting from uobject

#

That should be created on the server right?

kindred widget
#

@mighty zinc Should be created where ever you need to use it. I don't believe you can replicate UObjects by default, so they'd be per machine only just like a non replicating actor.

mighty zinc
#

I only want it on the server

#

But it should play anims on the client

#

I've overridden a func

#

Is supported for networking

#

But it is only playing anims on the server

kindred widget
#

You're gonna need to do that via replicating Actor or a replicating ActorComponent of a replicated Actor. UObjects don't have the ability to RPC or Replicate by default.

#

I mean you could have an object on the server that tells server versions of the actors to tell their client versions to do stuff? But the object itself cannot connect to clients.

mighty zinc
#

Hmm

kindred widget
#

There are some people who've went to the difficulty of making UObjects replicatable. But I wouldn't have the first idea where to start with that. Most likely editor source.

#

What are the animations for?

mighty zinc
#

Im makeing an attack component type thing

#

I have an attack component

#

Whick contains a u object which has all the anims in it and the imfo about combos and stuff

kindred widget
#

If your Component itself could replicate the state in some simple variables, your clients could play their animations that way. Either via RPCs, Repnotify, or doing simple replication and letting an animblueprint pick it up.

#

Then both client and server could have it's own UObject and query it for the correct animation to do.

mighty zinc
#

Thanks:)

#

Been searching for hours what was wrong with my code

kindred widget
#

Nah. I believe that only actors technically replicate. I know that you can make a replicating actor component as well, but it also has to be added to a replicating actor to actually replicate, so it likely goes through the actor class somehow.

summer tide
#

@lost inlet Thanks and setting location of obects need to happen on server as well right

lost inlet
#

well yeah, you pass the location to SpawnActor anyway

summer tide
#

No after spawning the actor. Let's say I have a ref to it

soft relic
#

Yes and also make sure you have replicate movement enabled

#

On the actor default settings

tidal quarry
#

Hey all, I'm trying to speed up projectiles on the server in order to mimic blizzard's profectile lag compensation. Speeding up so it catches up to where the projectile would be if spawned when the initial player cast it.

My projectile right now is NOT replicating back to the original owner, so it's spawned on the client, and then spawned on the server and that one is replicated to proxy clients.

I can't seem to figure out how to speed it up only on the server. Has authority check before change speed still changes both projectiles. Anyone know how I can check that the projectile is just the one on the server and speed only that one up?

kindred widget
#

@tidal quarry If I read that correctly, you basically want to know if the code you're running is on the server version of the object?

tidal quarry
#

yes

kindred widget
#

Blueprint or C++?

tidal quarry
#

blueprint

kindred widget
#

Use IsServer.

tidal quarry
#

has authority node still runs the code on both.
so does "run on server"

kindred widget
#

Then you're replicating it somehow.

tidal quarry
#

is it being replicated back anyway? even though I have net relevancy set to not owner?

kindred widget
#

It won't run on both if it's behind that check unless you're doing something that's replicated, which would then run on the server, and afterwards run on the client anyhow.

tidal quarry
#

If i put a print in the function that's behind the authority check, it shows both client and server

kindred widget
#

What event are you doing this on and can I see your logic train?

tidal quarry
#

this is begin play

#

I'm using GAS and gameplay task to spawn the projectile, then setting owner

#

my projectile parent is a class with this set

kindred widget
#

Hmm. I wonder if that's being spawned on the client as non replicated as well? Let me test that quick. Cause I'm semi certain that HasAuthority will return true if it's a client spawned actor and the check is on the client.

tidal quarry
#

ahhh

#

that could be it hmm

#

a quick "is server" check shows it

lucid vault
#

Yeah, authority doesn't = server

#

Client will indeed return true if client is authority

kindred widget
#

Yeah, just confirmed that for client spawned actors.

tidal quarry
#

ok i can set speed on server now, but it doesn't actually speed up ^_^

#

does setting initial speed after begin play not speed up an object? i thought it did. or is something else going on

lucid vault
#

I have a scene component that is parented to my character's head bone. This way, the scene component follows where the player is looking.

However, the SERVER version of a client's scene component does not update location when the client looks around, UNLESS the server player is physically looking at that client character. There is some sort of relevancy at play here, and I'm not understanding

kindred widget
#

@tidal quarry I don't believe so. I think that's just for setting the initial velocity via the length 1 vector. I'm fairly sure for a projectile movement component, you'll have to set the velocity.

#

Basically just turn velocity into a normalized vector, then multiply it by your new speed.

tidal quarry
#

Thanks! it works

#

Now just need to set correct velocity based on client ping πŸ™‚

#

and we have overwatch projectiles i think

kindred widget
#

I think I've honestly scared myself to actually start a real multiplayer project. I love the multiplayer theory crafting and have a nice design and scope I'd love to do, but thinking of actually doing it is terrifying.

lucid vault
#

Ahhh, my client spine rotation isn't updating on the server when the server isn't looking at the client. 😠 Anyone know why this is?

winged badger
#

@kindred widget unreal networking doesn't bite

#

at least, not literally

kindred widget
#

That reminds me though. I'm still looking for a solid way to manage collectible foliage in multiplayer.

winged badger
#

FFastArraySerializer

#

single replicated actor

#

and all foliage is not replicated

#

your FFastArraySerializerItem would look something like

#
UPROPERTY() int32 FoliageID; // something you can use to grab a DT row or DataAsset, doesn't have to be int32
UPROPERTY() FTransform SpawnTransform;
UPROPERTY() FFoliageStatus Status;

TWeakObjectPtr<ACollectableFoliage> FoliageActor;

PostReplicatedAdd
{
  causes actor to be spawned, sets the Foliage Actor
}
PostReplicatedChange
{
  if FoliageActor use Status to update it
}
PostReplicatedRemove
{
  causes FoliageActor to be destroyed
}
#

you can use multiple AFoliageNetworkManager?s to cover areas of the level if its large enough to warrant it, in that case server would find closest NetworkManager to SpawnTransform and add a new Item to it

#

performant, reliable

kindred widget
#

And this is the struct that inherits from FFastArraySerializerItem?

#

If I just read the example correctly.

#

Gonna try setting up a quick test of this.

winged badger
#

@kindred widget you FFastArraySerializer will need the Actor that holds it to push a reference to itself into the fastarray

#

or you'll have to setup delegates from the fastarray

#

because you won't be able to spawn those actors without world context

#

one important note is

#

if you go for pushing a TWeakObjectPtr<AFoliageNetworkManager> Owner; into the fastarray

#

do not UPROP it

#

and use a weak pointer

#

otherwise if you derive a BP from BP from the c++ base that has that fastarray

#

the UPROP will get serialized

#

and owner will end up being the CDO of native base class

#

❀️ unreal

#

(talking about doing MyFastArray->Owner = this; from constructor

#

you can also get away with nor replicating the entire tranform, just netquantized location/rotation

kindred widget
#

I probably won't even care that much about rotation. Location is enough most likely.

winged badger
#

and if there is no scale, you can just do a single FVector_NetQuantize instead of transform

kindred widget
#

Not exactly sure why, but this is throwing a fit from the example I was following.

struct FFoliagePlacementArray : public FFastArraySerializer
{
    GENERATED_BODY()
        UPROPERTY()
        TArray<FFoliagePlacement> FoliagePoints;
    bool NetDeltaSerialize(FNetDeltaSerializeInfo& DeltaParms)
    {
        return FastArrayDeltaSerialize<FFoliagePlacement>(FoliagePoints, DeltaParms);
    }
};```
#

Specifically the return.

winged badger
#

nope

#

the array has to be called Items

kindred widget
#

Ohh, he was literal about that. I thought that was just to line that up with the other one.

winged badger
#

pretty sure hew was

#

never tried

kindred widget
winged badger
#
FastArrayDeltaSerialize<FInteractionInstigator, FInstigatorContainer>(Items, DeltaParms, *this);
#

from one of mine

#

its also not just the Placements you replicate with it

#

so the naming could use an upgrade

kindred widget
#

Probably. What is the last parameter in that? It seems to be what was missing from this example.

#

*this

winged badger
#

its the FastArray itself

#

its this in the context of its member function

#

where did you pull the example from?

kindred widget
#

Here. I know it's a little dated just because he's still using GENERATED_USTRUCT_BODY

winged badger
#

NetSerialization.h header, engine

#

very much worth a read, it has most of unreal's docs for net serialization in it πŸ˜„

kindred widget
#

Do I actually still use the old GENERATED_USTRUCT_BODY even in mine, or should I keep using GENERATED_BODY ?

winged badger
#

you can always use GENERATED_BODY

#

the header is old-ish but not as much as that guide you found

#
    UPROPERTY()
    TArray<FExampleItemEntry>    Items;    /** Step 3: You MUST have a TArray named Items of the struct you made in step 1. */
#

its why i never attempted to call it anything else

kindred widget
#

Fair enough. I just assumed it was to match up with the return below.

winged badger
#

we run ~1500 actors via somewhat more complicated version of this through fastarrays instead of replicating them

#

our network manager actors are made to run in conjunction with interaction interface

#

and interactable actors are not replicated, but are net addresable, so we also replicate a pointer to them

#

you will probably need to make your foliage netaddressable as well, come to think of it

#

if your interaction is just harvest anything in range, you won't

#

as server can then find foliage in range and harvest it

#

if you want to send a pointer to specific collectable through an RPC you will need net addressable foliage

kindred widget
#

I was mostly just considering sending an RPC to the server to have the change the array, and then remove the instance via the replication. Thankfully it's just a little coop game though, so I'm not that crazy about cheat prevention or such.

winged badger
#

that is achieved by making sure each foliage actor is spawned with exact same name on server/clients

#

and overriding IsFullNameSupportedForNetworking to return true

#

you can set the name via FActorSpawnParameters::Name

#

any foliage that is preplaced on the level is easier

#

i gave you the fastarray pattern for procedurally spawning it

kindred widget
#

Well, I'll likely be using the fastarray in other places too. So it's good to learn it. I've been meaning to for a while.

winged badger
#

for pre-placed foliage

#

you just need a pointer to foliage actor and status of foliage

#

and you also don't need to add their items to array server-side before you actually change something

kindred widget
#

I made a little actor that did that at one point. Literally just an array of points, which updated only when the foliage was collected, and it'd remove any of the foliage for that type at that point on all clients, and eventually remove the entry, which respawned it on all client.

#

On a side, note, what do I need to include for the FastArray? Is that just UnrealNetwork?

winged badger
#

this is a much more precise beast

#

NetSerialization.h

#

we don't even use TArray replication anymore, except for super simple small stuff

#

Actors running those fastarrays can (because they drastically reduce number of actors considered for replication) run with high priority and high net update frequency

#

makes your network respond beautifully

#

we have interaction wheels networked and shown over our players heads while they are interacting

kindred widget
#

Hmm. This include is being a dick.

winged badger
#

before we switched to fastarrays that was horribly choppy

kindred widget
#

Do I need a module included to use this?

winged badger
#

#include "Engine/NetSerialization.h"

#

and no

#

missing module includes are linker errors

#

that happens only after a successful compile πŸ˜„

kindred widget
#

Nope, just me derping. Got so excited to compile I ignored the green squigglies and didn't add the functions to the .cpp file.

#

Yeeeeah. It's aliiiive!... At least as much as a static mesh. It exists.

winged badger
#

i imagine they would be slower then normal TArrays in SP, although not by a significant margin

#

about the same as if you were to wrap your array in a struct

kindred widget
#

So this is just specifying the array's structure. Do I need to add a Uproperty of the FFastArraySerializer with the Items in it to my class now?

winged badger
#

and it needs to be a replicated one

kindred widget
#

Just a normal property of that, not an array of it, right? Since the array is actually inside of that as the Items?

winged badger
#

UPROPERTY(Replicated) FFoliagePointArray FoliagePoints;

#

in tha actor that replicates it

kindred widget
#

Okay. Now that I'm done derping with getting that actually replicated...

#

Do I simply modify the Items array in it and mark the new entry as dirty?

kindred widget
#

AHA! Victory. So using Add_GetRef is an easy way to also mark the item as dirty. That was oddly easy. I've been putting off learning that for months.

summer tide
kindred widget
#

Doesn't that just happen automatically? Won't both the server and client's CMC set the movement to swimming when it's character enters a water volume?

meager spade
#

also you would not want to multicast a state

#

that is terrible

#

MovementMode should only ever be set on local client and server, never on simulated proxies.

#

also overlaps fire on client and server

#

so multicast seems a bit weird.

#

and server rpc seems weird

summer tide
#

Yea thought so that's why not working. So to fix it. I have to move movementMode out of it

kindred widget
#

I honestly just assumed it was automatic since the volume is on server and client. No networking would have been needed.

meager spade
#

no you dont need to multicast or server rpc anything

#

just set movement mode to swimming

#

in the overlap, and back to walking on overlap end

#

no need for the rpc's

summer tide
#

I think i tried it didn't work. ok let me try that quickly

meager spade
#

overlaps ALWAYS fire on client and server

#

if it exists on them

#

its how automatic doors work in our game

#

we do 0 replication on the door open/closed state

#

the overlap handles that

summer tide
#

What about the physics volume? DO I have to place one in the world or not needed?

meager spade
#

ofc you do

#

how else you going to detect water?

kindred widget
#

Out of curiosity. How big is a FastArray allowed to be? Is there a general limit?

meager spade
#

not really

#

i heard in fortnite they have 1000's of items

#

that is the beauty of them

#

it only replicates the new, changed or removed item. Also has client side callbacks PER item.

kindred widget
#

So no issues with one having four to six thousand entries possibly?

meager spade
#

nope

kindred widget
#

Brb, making multiplayer game.

lucid vault
#

Anyone know how I can make my client animBPs always relevant on the server?

#

My modify bone transform nodes for the spine don't change on the server for simulated proxies unless the server player is looking at the skeletons

#

It's super strange

fossil spoke
#

There is a setting somewhere that changes the update rules for skeletons.

#

You sound like you have it set to update only when rendered

lucid vault
#

Is that an animBP or skeleton option?

#

I'll have a look

fossil spoke
#

Not sure cant remember.

#

Its most likely on the SkeletalMeshComponent of the Actor thats using the Skeleton.

lucid vault
#

Hmm, the only modified property that i have is UpdateJointsFromAnimation. I will look around and see if the animBP has any variables that work

#

Unless the default behavior is what I am experiencing, in which case I may play around with some mesh settings

#

VisibilityBasedAnimTickOption must be what you were referring to

#

I have it set to always tick pose

#

Ayyyy

#

Setting it to AlwaysTickPoseAndRefreshBones worked

#

I wonder if that was the default setting. It doesn't even show a modified icon next to that option when changed

fossil spoke
#

πŸ‘

kindred widget
#

Trying to learn the Pre and Post replication settings for the FastArray. I assumed the argument from this was the array with the Items in it, but I can't seem to get the struct's properties out of the Items in the Items array from that argument. Do I need to cast that somehow?
void FFoliagePlacement::PreReplicatedRemove(const FFoliagePlacementArray& InArraySerializer)

winged badger
#

you have the entire struct there

#

just before it gets removed

kindred widget
#

But what is the argument for? Isn't that the array that it's a part of?

winged badger
#

it is

kindred widget
#

How come I can't... Oh.

#

I'm dumb again.

winged badger
#

i generally use it to broadcast a delegate in the array

#

then actor that listens to it responds by making changes

#

losing track of scopes i take it?

kindred widget
#

I was trying to do InArraySerializer.Items.Location, not InArraySerializer.Items[Index].Location. >.< This week has frazzled me.

winged badger
#

i usually end up implementing a ton of QOL stuff on my fastarrays

#

operator[] (int32 Index)

#

iterators

#

add/remove functions

#

and so on

#

basically just wrapping TArray stuff + some fastarray specific stuff if needed

kindred widget
#

Yeah. I'm definitely going to play around with this most of tomorrow most likely. Thank you for the help on the understanding it though! Going to make some design work a lot easier.

summer tide
#

@meager spade So I have placed one physics volume in the level. When one of the players is in the water, the other one appears get its volume enabled prior entering water. Is the overlap issue or flaw how it was done

summer tide
#

So I have this object and I want to set its location so that both can see it

bitter swift
#

How do I disable Render Main (mesh) for the owner only? Running it through a custom event with Owning Client doesn't work. It also disables it for everyone else

bitter swift
#

Okay so apparently it does work... Just not when I access the custom event through Begin Play for some reason.

unkempt tiger
#

I wonder.. should a 'use / interact with' action be predicted? spinthink

#

Or can it just be handled by a player controller?

bitter swift
#

I made a really dumb "fix" that applies whenever the player moves the character and then it only happens once. It works though πŸ˜‰

vocal cargo
#

@winged badger just curious... you seem like you know a lot about ue4 multiplayer, and I hope you dont mind me asking, but do you freelance? And if so how much is your rate?

#

you can PM me if you dont feel like replying here

#

or just dont if you dont feel like replying at all 😁

meager spade
#

@vocal cargo unless you can drag him from his current job, i doubt that πŸ™‚

summer tide
kindred widget
#

@bitter swift What is that even doing? That shouldn't even need networked. Control input is always local on the client. So that RPC isn't going anywhere.

#

But besides that, be very careful about using reliable RPCs on tick like that.

fringe dove
#

"Improvement: Consolidated client-server character movement RPCs to a simple function signature using a new extensible struct, to more easily support custom data in RPC parameters without having to change engine source. This allows for customized serialization that can more efficiently pack the data over the wire, and solves some previous ordering issues with ServerMoveOld being sent as a separate RPC function. See the feature docs for more details."

#

anyone know where to find those "feature docs"?

fossil spoke
#

Most likely source code comments lol

#

Sounds like a purely CMC optimization though.

turbid crest
#

what is the best way to have a lot of servers

#

the only servers i made are a big mc server and some tf2 and csgo servers

karmic briar
#

wanna add on the swihmhmhing conversation above,in your custom cmc how would you handle swhimming?i'd imagine making a fucntion that hhshwitch the movhehmehnt mode to swimming

bitter oriole
#

@turbid crest Well, you just rent them I guess.

turbid crest
#

oh

kindred widget
#

If you want dedicated servers, you simply host them somewhere yourself. Otherwise you might allow community servers. Let players host/moderate their own. Depends on game.

somber glade
#

Does a variable that is exposed on spawn need to be replicated, or will that be passed to the client as part of being spawned?

chrome bay
#

Would need to be replicated

somber glade
#

okay thanks. I knew if it was set in the defaults it was fine, but I wasn't sure what happened with those when an actor was spawned.

chrome bay
#

yeah, the engine assumes serialized properties are the same on both ends

somber glade
#

I guess that makes sense. I guess there are times when you might want to spawn an actor and not have some exposed value replicated to the clients.

kindred widget
#

Hey Jambax. How do you normally have a replicated FastArray have the actor holding it do something? I stuffed a reference to the actor in the FFastArraySerializer itself and used that on PostReplicatedAdd, but I'm assuming there's a better way than this?

chrome bay
#

Hmm I mean you could just use an OnRep callback

#

I don't think there's anything wrong with holding an Owner property though

kindred widget
#

It seems to be working at the moment. I'll stick with it I guess. I just didn't want to iterate over the array each onrep to get the deltas to do stuff just with those.

winged badger
#

@kindred widget simplest approach is weak non-UPROP pointer to owner in FastArray, that owner just sets to this in its constructor

kindred widget
#

What is the Weak pointer for? I fully understand hard pointers. Physical memory address. But what is the difference between that and a Soft/Weak pointer?

bitter oriole
#

Weak pointer has the benefits of UPROPERTY (gets nulled on deletion of object) without taking memory ownership as a hard pointer does

winged badger
#

and it doesn't need the UPROPERTY to get nulled if what its pointing to is explicitly destroyed

#

and you don't want the Owner in fast array to be UPROP because of a blueprint serialization bug

#

blueprint derived directly from native class will work fine, but anything derived from that blueprint will break

#

and have the Owner pointer point to CDO of the native class, instead of the Owner's instance

kindred widget
#

I'll test that out. First time ever using weak object pointers. What is a Soft Object then? Someone once described it as some form of address that can also load the object if it's needed? Isn't that only useful for like static meshes or textures/materials sort of thing?

winged badger
#

that is for referencing the assets without having them loaded automatically when the object that has the soft object member is loaded

kindred widget
#

Ah. There we go. So just this in the FFastArraySerializer? TWeakObjectPtr<AActor*> ContainingActor = nullptr;

#

Then, set that in the AActor class's constructor?

winged badger
#

yes

#

except

#

no * inside <>

#

and you can have it be of the owners type, too

kindred widget
#

I did. Just used AActor here for simplicity.

winged badger
#

any use of owner strongly couples that fast fastarray with the ac tor containing it anyways

kindred widget
#

And setting it is the same as a normal pointer, just that property = this?

winged badger
#

yes

#

weak pointer has overloaded operators so you can work with it like a hard pointer

#

if you need to get the hard pointer from weak pointer, just do .Get()

halcyon totem
#

does anyone know if every blueprint on the level should have an owner? I keep seeing these messages in the output log but dont know what it really means

winged badger
#

that is what you get when you send Client/Server RPCs through an Actor not owned by a PlayerController

kindred widget
#

Hmm. Now I seem to have bugged my HISM component. It's running the replication and add functions all correctly on the client, but no tree.

#

@winged badger Are you sure that setting it in the constructor is okay? It seems if I set it on beginplay, it's running fine, but the constructor... while registering that it's valid, doesn't seem to want to work for.. some.. reason? That doesn't make any sense.

winged badger
#

its fine if its not a UPROP

#

you can do BeginPlay if you like

kindred widget
#

I'd rather the constructor. Valid earlier... and Like I said, it's valid, but.. Like.. Hmm

#

Let me post some stuff.

winged badger
#

thing is

#

OnReps go before beginplay

#

for the initial properties

#

and it would either not pass a null check or crash, if it wasn't valid

kindred widget
#

Okay. Had to recompile three times just to be certain it wasn't working.

#

Right. Images are borked

#
        UHierarchicalInstancedStaticMeshComponent* HISMComponent = nullptr;

    UPROPERTY(ReplicatedUsing = FoliageArrayUpdated)
        FFoliagePlacementArray FoliagePoints;```
#

The array thingy with the weak pointer.

struct FFoliagePlacementArray : public FFastArraySerializer
{
    GENERATED_BODY()
public:
    UPROPERTY()
        TArray<FFoliagePlacement> Items;

        TWeakObjectPtr<ACFoliageReplicator> ContainingActor = nullptr;

    bool NetDeltaSerialize(FNetDeltaSerializeInfo& DeltaParms)
    {
        return FastArrayDeltaSerialize<FFoliagePlacement>(Items, DeltaParms, *this);
    }
};```
#

Actor constructor.

{
     // Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
    PrimaryActorTick.bCanEverTick = true;
    SetReplicates(true);
    bAlwaysRelevant = true;
    
    HISMComponent = CreateDefaultSubobject<UHierarchicalInstancedStaticMeshComponent>(TEXT("HISMComponent"));

    FoliagePoints.ContainingActor = this;
}```
#

The post rep add

{
    FVector TestVector = Location;
    FString TestString = TestVector.ToString();
    UE_LOG(LogTemp, Warning, TEXT("%s"), *TestString);
    UE_LOG(LogTemp, Warning, TEXT("THIS IS FIRING!"));

    if (ACFoliageReplicator* FoliageActor = InArraySerializer.ContainingActor.Get())
    {
        UE_LOG(LogTemp, Warning, TEXT("Weak Object Valid"));
        FoliageActor->AddMeshToComponent(Location);
    }
    else
    {
        UE_LOG(LogTemp, Warning, TEXT("Weak Object NOT Valid"));
    }
}```
#

And the small function it calls

{
    // Location passed through correctly.
    UE_LOG(LogTemp, Warning, TEXT("Mesh is getting added"));
    HISMComponent->AddInstance(FTransform(Location));
}```
winged badger
#

and attaching the HISM to anything?

kindred widget
#

That.. I overlooked.

winged badger
#

also, be explicit when you set root component

#

otherwise BP will pick one at random

kindred widget
#

But question. Why does that all go through to the Mesh is getting added log if I simply set the array's pointer in beginplay rather than the cosntructor?

#

Gonna make sure to specify the HISM as the root component and see if that works.

#

Nada. Still runs all of the way though the logs like it's valid, but no tree.

#
LogTemp: Warning: THIS IS FIRING!
LogTemp: Warning: Weak Object Valid
LogTemp: Warning: Mesh is getting added```
#

If I move that one line on the bottom of the constructor to beginplay, it works though?

winged badger
#

BeginPlay is too late if you add stuff to array in the tick you spawn the actor

#

or if you have an array of default instance editable locations for preplaced actor

#

PreNetReceive works

#

but

#

if your mesh is getting added

#

the fastarray workd fine

#

problem is later

#

like, client not knowing what mesh asset to use

#

also? logging

#

use breakpoints

kindred widget
#

I think the mesh is set as a default value for the HISM component. The array is being added to on Beginplay behind a != NM_Client.

winged badger
#

well, breakpoint in AddMeshToComponent

#

step in, see whats going on

#

check the HISM in locals, that sorta thing

kindred widget
#

Gonna do that. But what would the array's pointer to it's owner have to do with that, and what would setting it in the constructor vs beginplay have to do with that, if it's still firing and valid on both?

winged badger
#

logs only have limited debugging use for debugging blueprints from a packaged version

#

say i spawn the actor at runtime, the ACFoliageReplicator

#

and add some foliage to it

#

immediately after

#

actor replicates to clients

#

first its replicated values are set, that includes the fast array

#

callbacks from items are called, owner hasn't been set yet, so they fail

#

then comes begin play and you set the owner

#

bit of a timing problem there

#

same thing if you were to preplace the ACFoliateReplicator on a level and give it some default foliage locations on the instance

#

callbacks get called before the owner is set

kindred widget
#

I would have assumed that setting it on beginplay would drive that to be even worse? Cause Beginplay is much later.

winged badger
#

and since its printing "Weak Object Valid" you don't have a problem with fastarray owner

#

something unrelated to fastarray is failing

#

as long as this HISMComponent->AddInstance(FTransform(Location)); gets called

#

fastarray has done its job, correctly

#

the only possible fastarray related problems are

halcyon totem
#

the internet broke

#

youtube dowb and I cant upload screen shots to discord

winged badger
#

1 - your FVector Location; in FastArrayItem is not a UPROP or has NotReplicated specifier

#

2 - you never set the Location on the Item server side

#

in both cases, when HISMComponent->AddInstance is called, the Location would be 0,0,0

halcyon totem
winged badger
#

definitely not

#

that is wrong in more ways then the number of nodes used for it

halcyon totem
#

Do I need to set an owner? my doors and stuff open in the game

winged badger
#

that causes the owner to be mismatched on every instance of the door on every machine

#

you don't set the owner on a door in order to open it

#

and you set the owner only and only on server

#

and you avoid GetPlayerController[0] like a plague

kindred widget
#

@winged badger The FastArrayItem's Location property is definitely a UPROPERTY. And if I log the Location coming through the AddMeshToComponent, that runs on the client, it prints correctly at the test spot of 0,0,100. Which is only set from beginplay on the server version of this actor.

bitter oriole
#

@halcyon totem Basically if you want a player to open doors, the true solution is to have the player controller RPC itself from client to server with a "server open door" function that takes the replicated door actor as a parameter, and does the door opening server-side.

winged badger
#

then your problem is not in the fast array

potent cradle
#

πŸ€”

winged badger
#

its a user specific statement

kindred widget
#

It's only useful client side for client specific things.

winged badger
#

he doesn't know enough to use it correctly

potent cradle
#

Ah, I interpreted it as being generally bad to use. I was gravely concerned for a moment there.

winged badger
#

and relative path is always better

#

well, GetGameInstance()-<GetFirstLocalPlayerController() can do the same job

#

without ever having unintended sideeffects

potent cradle
#

πŸ€”

#

Seems like more trouble?

winged badger
#

GetPlayerController(0) is responsible for almost all cross-wiring bugs on this channel

#

"why does my host die when my client hits zero health?"

#

and a million variations of

kindred widget
#

I've only ever found it particularly useful is to use it from Userwidgets, on multiplayer projects.

winged badger
#

the only use i have for it really

#

is GetGameMode->GetNumPlayers->For (0 to NumPlayers-1)->GetPlayerController[Index]

#

from blueprints, have better ways to iterate controllers in c++

#

its also useful for splitscreen

potent cradle
#

Hmm, I'll keep a critical eye when I find the node in my logic. I think I've used it a fair bit, made me question myself a bit πŸ˜„

winged badger
#

its a lazy function that lets epic people that make tutorials create them fast and in such a way that all people new to unreal following them break their network

potent cradle
#

Wherein lies the fatal flaw?

#

Or when you say "cross-wiring bugs"

#

Different outcome expectations on server vs client?

kindred widget
#

It just comes down to the machine differences on the call. It's useless to use on a Dedicated server. It'll return the first player connected. On Listenserver it'll return the listenserver player's controller, and on a client or singleplayer it'll return the local client. Since most networking is often done between the server/client version of the same actors and most of that is from server to client, it makes that call very pointless in a lot of cases because you shouldn't ever use it server side for server things. Because most client to server networking is done through the controller or character anyhow, and they have easy ways to RPC already without using those calls.

winged badger
#

say you send a ServerRPC to shoot a gun from a Character

#

and instead of sending a pointer to a character or weapon through the RPC

#

you just make the RPC shoot for GetPlayerCharacter[0]

potent cradle
winged badger
#

RPC gets to server, GetPlayerCharacter[0] gets evaluated on server for the shot

#

in cast of listen server, whenever anyone shoots, listen server host shoots instead of them

#

in case of dedicated server its not listen server host, but the first player that logged in instead

#

which works just... great πŸ˜„

potent cradle
#

You mean, you evaluate GetPlayerCharacter[0] on the server? Versus sending the result of GetPlayerCharcter[0] through the RPC? Meaning you'd send a pointer (?)

winged badger
#

yeah

potent cradle
#

Ahhh yes

#

Gotcha

winged badger
#

GetPlayerCharacter[0] is not the same on server and client

potent cradle
#

Right yes

winged badger
#

even if its in the same BP

potent cradle
#

Yeah

winged badger
#

which is what often causes problems for network newbies

kindred widget
#

It gets even funnier when people send GetPlayerController0 through a character RPC rather than simply sending nothing and getting the pawn's controller on the server.

winged badger
#

that at least, works πŸ™‚

#

kinda

kindred widget
#

It does. But. Ugh.

#

Well. I made.... Progress? Now I can't get a tree to spawn no matter where I set the owner. :/

#

Oh wait, it's also not valid anymore.

potent cradle
#

You were doing something with foliage right? What was your reason for going beyond standard HISMs and such?

#

Caught a few messages here and there

kindred widget
#

Collectible foliage. I'd prefer to have the rendering speed of HISMs. So I can't just replicate foliage actors. So, I'm making a little tool that'll collect foliage data at map load and let the server spawn/destroy foliage at locations on clients too.

potent cradle
#

Couldn't you just send an RPC to remove an HISM instance across all clients, each time you collect it?

#

From a level that was seeded beforehand

kindred widget
#

Could, but that won't hold state. Gets tedious to make sure that happens on new clients who join in. So using replication is much better. And using FastArray is even better. I already did this using normal array replication, but the FastArray allows you to send single structs of data rather than whole arrays for single small changes here and there.

potent cradle
#

I shall be noting this duly.

winged badger
#

and it has per item callbacks

#

each entry has individual client side callback for add/remove/change

potent cradle
#

Like, a per item repnotify?

winged badger
#

yes

potent cradle
#

That sounds pretty sexy

winged badger
#

fastarray = awesome

#

TArray best left for simple replication that doesn't require any callbacks

potent cradle
#

Because the whole thing would be replicated each time, correct?

winged badger
#

because you'd have to compare the entire array with the old one

#

to figure out what changed

potent cradle
#

Right, to find the difference

#

Yeah

#

Clever

#

Is this all in BP as well? Or C++ only?

kindred widget
#

FastArrays are C++ only. Technically. I mean you could make blueprint calls to alter it, but the setup is entirely C++

#

Lolwtf? I just printed the HISM instance count after one add and it's printing three. I have bugs.

bitter swift
#

@kindred widget I need to hide the mesh from the owner but without removing the shadow.
When I fire it in Begin Play it hides if for everyone - even if I use Owning Client Only.
I tried using a Key Event like Press T - and that works. Somehow I think BeginPlay is inevitably server based. So it has to come from an event that is ClientBased. I'm not even sure if that makes sense, I can only speak from what I have tried.

halcyon totem
#

can someone tell me why this is happening? I have a game that can open doors but if I place more then 1 game on the entire map, the second games cant open any doors, I thought that if I placed them in different streaming levels it would work but it doesnt seem to matter if another is placed somewhere it wont work

meager spade
#

3 days you have been working on this

#

and i already told you, your logic and stuff is completly wrong

halcyon totem
#

I have been fixing stuff

#

but still I just realized the client can open the first door and game but not the second but the server can....

#

how in the world can a client open 1 door and not the other?

torpid nymph
#

does steam have any sort of user verification like oculus does, where we can see if the user actually owns the game?

halcyon totem
#

good question @torpid nymph I remember games had CD keys

bitter oriole
#

Yes @torpid nymph though you'll probably need to call the Steamworks API directly

halcyon totem
#

kind of strange we have no protection

bitter oriole
#

Beware though, pirate players will just remove Steam support from your game if you start checking that stuff πŸ˜›

chrome bay
#

^

#

been there πŸ˜„

#

Found that players would just replace the steam.dll with a hacked one that bypassed all the checks.. so turned out to be a total waste of time

potent cradle
#

I wonder if there's really anything you can realistically do, the only thing that I've heard make good impact is making the OG version more interesting than the pirated one (frequent updates, steam workshop support, etc.)

chrome bay
#

There's not really

#

But if someone is going to go to the effort to pirate it, they probably weren't going to buy it anyway

torpid nymph
#

it's not that I want to have denuvo or something, but at least something that would take more than literally just upload your game folder to a torrent website would be great

bitter oriole
#

There's nothing really

#

Just update your game weekly

potent cradle
chrome bay
#

Maybe through word of mouth or something, IDK

potent cradle
#

but there's a huge margin of error

#

oh, snap

torpid nymph
#

I heard about that too

chrome bay
#

yeah, I doubt there's any solid link tbh

torpid nymph
#

but I doubt that is the same for indie games

potent cradle
chrome bay
#

You can to some extent control it on steam in a multiplayer game, by having the server check if a connecting player owns the game

#

And boot them out if not

#

Only really works for a handful of cases though

bitter oriole
#

The main point is that pirates will take a lot less relative time to kill your countermeasures than you will spend time creating them. As an indie, your development bandwidth is constrained already

chrome bay
#

yeah exactly

bitter oriole
#

If you're doing a competitive game with dedicated servers (why would you do that ??) then you'll need it for cheaters, and it's possible like Jambax said

#

If not, just don't

potent cradle
#

If you're doing a competitive game with dedicated servers (why would you do that ??)
I feel personally attacked

#

πŸ˜„

chrome bay
#

doing it. don't advise

#

πŸ˜„

bitter oriole
#

I have opinions and I use them

potent cradle
bitter oriole
#

Seriously though, I felt like my biggest problem piracy wise was G2A/Kinguin stuff

#

It's a much better value for players than piracy because you get a real Steam key to the game

chrome bay
#

I seem to remember a few devs actively just saying "please just pirate my game rather than buying a key"

bitter oriole
#

Fortunately it's also much easier to prevent (by never giving away Steam keys to anyone who asked for them)

potent cradle
bitter oriole
#

Bit of everything - stolen cards, real money that's being laundered, gamers with a lot of Steam cash from trading stuff

potent cradle
#

IIRC it was something like: use compromised credicard data, buy a bunch of games, sell them, see how Steam never revokes the keys because they'd hurt the consumer who has plausible deniability.

bitter oriole
#

Fake review key scams and gifting from a cheaper area appeared to be the trend some time ago

#

(Funnily enough the answer to the G2A fake review scammers is to simply give them a DRM free build to download)

ember needle
#

ok this should be pretty stupid... I'm setting a RepNotify Variable on server in a GameState, shouldn't it be replicated on clients?

#

this is after a seamless travel... so I wonder if for any reason there's an issue there

kindred widget
#

Gamestates should persist through seamless travel I'd think. Kind of odd behavior if they don't. The value is set before or after the travel, and is it correct on the server afterwards?

ember needle
#

yes it's correct on the server, but the client does not have the onrep event triggered.

#

weird.

#

i always thought that server can set variables on the GS that will be replicated on clients.

#

clients of course cannot even send to server.

#

i really have just a BEGIN PLAY -> SET REP VARIABLE -> print "hello" in the OnRep of the rep variable

#

doesn't get printed on client

#

that's all i do

kindred widget
#

It might not be firing since it's the same on client and server.

#

Ah, with the switch that would be odd.

ember needle
#

I had the value TEST inside of the LevelNames default array. DUH

#

not here, I meant really in the variable

#

dumbass

kindred widget
#

It probably just assumes you've already done your testing and are doing something complex like prediction.

ember needle
#

ehehe

bitter oriole
#

Gamestate travels seamlessly now ?

kindred widget
#

πŸ€·β€β™‚οΈ All assumptions on my part.

ember needle
#

well it gets recreated anyways.

#

but it's a good practice to inherit from the same GS (lobby & gameplay)

#

basically, I want to create the streaming levels ONLY when the level is started (called from the level BP) AND the variable has been replicated

#

due to race conditions I use this stupid trick

bitter oriole
#

I'm pretty sure game state is not kept when traveling

#

Player state is, to some extent, depending on implementation

ember needle
#

gets recreated, indeed.

#

AFAIK only the game instance does not get recreated. All others are, even after a servertravel

bitter oriole
#

Game instance persists from game boot to game quit

ember needle
#

yep

bitter oriole
#

PlayerState is re-created but can opt in to copy variables

ember needle
#

yes

#

but still, it does fire BeginPlay

#

so it gets created after the travel

bitter oriole
#

Yeah

ember needle
#

what do you think of the trick there stranger, feels naif to me, but are there other options?

steep flame
#

For an Ability, I let characters move out of control into a direction for a set time with
PawnToMove->AddMovementInput(WorldDirection, ScaleValue, bForce);
I do this Logic by calling an RPC from the Server to the Client. But this isn't Hacker / Cheat safe right? You can just manipulate the RPC from the Client to not call AddMovementInput right? I'm not to familiar with Hacking / Cheating.

ember needle
#

why don't you just move the pawn from the server by setting its transform? It will get replicated on clients, the server is the only authority in terms of location

#

it's also probably more precise than using movement input

steep flame
#

Because AddMovementInput was just the easier solution ^^

ember needle
#

not really, no

#

at least, not imho πŸ™‚

steep flame
#

For setting the transform I need to take the movementspeed of the character and calculate the distance within each tick. And to be as precise as using the movement input, I also need to calculate the acceleration, because the character doesn't start at max speed. With using movement input, I just simulate inputs ^^ Or am I missing something @ember needle ?

ember needle
#

it really depends on what movement you want to add to the character and why

steep flame
#

Just normal movement, as you would move him forward

#

why: Because he get's controlled by some force and that force moves him in a random direction

ember needle
#

can't use just use addmovementinput on the character without RPC? Not sure about this though

steep flame
#

But he is more mind controlling him, that's why he moves normally

ember needle
#

hum

kindred widget
#

Like a "Disorientation" sort of effect?

steep flame
#

yeah

kindred widget
#

Let me test something really quick.

steep flame
#

thank you

ember needle
#

@kindred widget is at it again πŸ˜„

kindred widget
#

Haha. To be fair, this is also how I learn. I've probably learned 80% of what I know just solving other's issues. Saves me from the problem later.

ember needle
#

and everybody thanks you for that

steep flame
#

good mindset Authaer πŸ˜„

ember needle
#

BTW if it's random you probably don't need an RPC, you just have the client do the randomness

#

if you're going this route, then the client can always ask to move around, that's ok

#

it doesn't protect you from hacks where this behavior gets disabled on the client though, that's for sure

steep flame
#

yeah

ember needle
steep flame
#

even free, cool

kindred widget
#

Hmm. Does CMC have a simple call to ignore a client's input on the server side?

ember needle
#

it might check if it's locally controlled, which returns false on the server

steep flame
#

Idk. I right now have a bool that just blocks my "MoveForward / MoveRight" call

kindred widget
#

I was kind of hoping for something more like Server explicitly ignores all client input, but still allows client to move it's own locally and for the server to move it's own. But the server wouldn't get overridden by client movement.

meager spade
#

what would the use case be for that?

kindred widget
#

That way you could just replicate a single direction as a yaw float, and tell the client which direction the server is gonna go. Then have them both move that direction, letting the client do it's own prediction..

steep flame
#

that's even better

kindred widget
#

@meager spade Just brainstorming ideas for a "confused" effect. Aimless wandering that the server only controls.

meager spade
#

i don't fully understand @steep flame's issue though or why you would let a player just move without telling server and replicating that to other clients?

steep flame
#

The CMC handles that doesn't it? It replicates the movement back to the server and then back to the other clients

meager spade
#

CMC does not replicate it to owning client (unless a correction is done)

kindred widget
#

You wouldn't. I was trying to get the server to ignore the client's input. Like.. disconnect the client and server's CMC, but make them still do the exact same thing.

meager spade
#

only simulated proxies

#

you mean make the player just move where the server wants him to go?

meager spade
#

and player can't override?

kindred widget
#

Without being choppy, yeah.

meager spade
#

RootMotion tasks

#

and disable input

#

RootMotion Tasks also run on Simulated proxies

#

and smooth

steep flame
#

I did this before, not sure why I changed to AddMovementInput afterwards. Need to try again.

kindred widget
#

Does disabling it on the server keep the client from reenabling it locally?

meager spade
#

re-enabling what?

kindred widget
#

Input. Cause I thought that was done on the client.

meager spade
#

input can just be disabled via a bool from the server right?

#

either a repl bool or a client rpc

steep flame
#

yes

meager spade
#

then you can run a root motion task which the server says move to this location

#

which will produce nearly no corrections

kindred widget
#

Well, true. Even if they cheated the input back on, the root motion would just override it.

meager spade
#

yes

#

that is how Fortnite do it

#

they set MoveDisabled tag

#

and RootMotion move the player

#

for certain abilities

steep flame
#

Okay, thank you @kindred widget @ember needle and @meager spade. RootMotion will probably work.

meager spade
#

RootMotionTasks != Root Motion Animation

#

Runtime/Engine/Classes/GameFramework/RootMotionSource.h

#

if you want to check it out

kindred widget
#

Already brainstorming game abilities. Then again I doubt I'll care that much about cheating in the end.

meager spade
#

it is c++ only though 😦

steep flame
#

it's fine

kindred widget
#

You could probably jumble up a similar effect in blueprint using timelines and some FintertoConstant with some floor checks on both sides. Might be less effort just to go with the root motion though.

steep flame
#

I already have GAS setuped and they already have RootMotion tasks setuped.

#

I also already had a RootMotion ability just for that, but I just can't remember why I discarded that

winged badger
#

they can't

kindred widget
#

I think that might be one reason I've never cared for starting to use Maps. If I needed one, I just made a simple small struct somewhere.

winged badger
#

you can project it into something that replicates, like array of key, value structs

#

and reconstruct it OnRep on the other side

#

its a fairly simple setup

summer tide
kindred widget
#

I probably would not replicate the cable component. My initial thought is to create a repnotify in an actor that has the component. Make that notify attached to an AActor pointer that points to an actor that is also replicated. Then on the notify, just attach that actor's cable to the newly replicated pointer.

summer tide
#

So from the screenshot, I have a variable that I store ref of the spawned actor. I can make that repnotify. Then in the notify Set Attach End To, i assume?

kindred widget
#

If I'm looking at this correctly. I assume that this is to connect the fishing line to the rod and the lure?

halcyon totem
#

ok now im going crazy, I was working in client mode trying to fix some code, and it worked in client mode finally, but when I run a listen server and play as client its not working!

#

I was so excited after 3 days of trying only to find out it doesnt work on a listen server client

#

isnt play as client the same as playing as a client on a listen server?

summer tide
#

@kindred widget Yes so I'm spawning the lure at a specific location then attaching the cable. I works in offline mode and in server only.

kindred widget
#

@summer tide I'd probably end up doing this with components rather than other actors. But sticking with your course. Which actor is the cable component in?

shell token
#

@summer tide sorry I’ve only read this quickly but are you using a rep notify to achieve your result ?

#

A rep notified delegate function is not called by the listen server which is where some inconsistencies occur switching from dedicated to listen, I’d try adding a β€œis listen sever check” and if true calling the rep notify function manually

kindred widget
#

It is in blueprint. Blueprint calls notifies on server too.

gloomy sedge
#

Hi, Back again. I'm trying to destroy and actor in multiplayer but having some problems. Theoretically, this should work?

#

But it never gets called, which i weird, Putting a print string in the Notify doesn't seem to trigger

#

The initial Event is not sent on server, is that why?

meager spade
#

you can't server RPC in an actor

gloomy sedge
#

ah

meager spade
#

unless its owned by a playercontroller

#

as the actor is replicated

#

all the server has to do is call DestroyActor.

#

and for a client to tell the server that, it has to go through the Pawn or PlayerController of the client.

gloomy sedge
#

Okay, so I should send the destroy actor inside of the Player controller?

meager spade
#

the Server RPC has to be in the player controller

#

with a pointer to the actor the client wants to destroy

#

then server can do Actor->DestroyActor()

#

and destroy is replicated automatically

#

no need for Destroy bool and OnRep

gloomy sedge
#

ah okay

summer tide
#

@kindred widget The fishing rod has all these code including the cable comp.

kindred widget
#

Just make a RepNotify pointer in the rod. Then spawn the lure and set the lure to that pointer, and use the repnotify to connect the cable component on each client.

gloomy sedge
#

@meager spade Thanks Alot! Working now

tidal crown
#

does PostServerTravel in AGameModeBase get called after the level stream is 100% complete?

#

meaning is it ok to spawn/posses players then?

summer tide
#

@kindred widget Is that what you mean in blueprint? I think you are talking in c++. To connect cable comp on each client, I'd have to use Replicate on Owning Client I guess, but the repnotify should take care of that right.

kindred widget
#

Nah. I mean BP. Just a normal repnotify, no specific conditions. Then you only spawn the lure on the server, and set that pointer on the server. Lure needs to be replicated as well for the pointer to point to the correct object.

summer tide
#

@kindred widget Based on what you see here. I see the cable only connected on server but still not on client. I think I am doing it wrong.

kindred widget
#

@summer tide Is BPCube1 actor class set to replicate?

summer tide
#

Yes It has replicated checked and spawns on server and client. The spawning is working. But the cable only connect on server

kindred widget
#

Put a print in the RepNotify, is it running on the Client?

summer tide
kindred widget
#

Hmm. That's odd. Is the replicated NewVar0 valid on the client?

summer tide
#

Maybe the cable needs to be replicated as well. It has replicate component on cable

#

Or parhaps the entire fishing rod needs to be replicated comp checked?

kindred widget
#

Nah, that was the point of doing it between the two actors. Cause the one actor has control over the cable on it's machines. Keeps you from replicating another object.

#

Is the NewVar0 actually valid on the client though?

summer tide
#

yes

kindred widget
#

O.o That doesn't make any sense. It should attach on client just like it's doing on the server then.

#

Now I have to doublecheck this. Hold up.

#

I can't make it not work.

summer tide
#

Let me check again.

#

@kindred widget THe only diff that I see is that I am passing the location instead of getting them directly from the actor

kindred widget
#

I can spawn it from a client input and pass along a location, but it won't change anything.

#

@summer tide Ohhhh. Man

#

I overlooked that, that's my bad.

#

Wait, so can the client see the server's fishing pole correctly?

summer tide
#

Yes

kindred widget
#

Like if the server player throws a lure, can the client see it attached correctly?

summer tide
#

No client doens't see that

#

Only server sees both

kindred widget
#

Okay, that wouldn't have changed what I thought it was. I thought it might have been an Owner issue.

summer tide
kindred widget
#

Is the fishing pole owned by the client's controller or pawn?

summer tide
#

I should check if the location shows correctly on both

kindred widget
#

Cause you can't send an RPC from the client through that if the owner isn't set to the client.

#

That still doesn't make sense for the client not seeing the server's pole cable correctly.

#

I could understand if the client could not spawn a lure, but where they can't see the lure correctly even if the server player throws it, that's odd.

summer tide
#

The lure is seen by both. It's only the client doesn't see the cable attached to the lure for both client and server. I probably screwed up somewhere.

kindred widget
#

Right. But the repnotify should work for that. It's odd that it's not.

gloomy sedge
#

Does anyone know if a Dedicated server can run multiple levels at the same time?

halcyon totem
#

if I have an actor thats a door, will switch have autority nodes have any effect on it when trying to do RPC?

normal jacinth
#

How do I execute functions across all clients, on their individual machines?

#

from GameState

meager spade
#

Multicast

summer tide
#

@kindred widget Thanks for going extra miles to help me with this. I got it working.

raw quarry
#

When there's no framerate cap set, my game takes 99% of my GPU (and I have a brand new top of the line one) and this happens to some of our players as well. For some reason, that causes the game to have what seems like massive packet loss and makes characters teleport and desync a lot -- anybody run into this before?

#

I'm not sure if I just have some configuration or something wrong?

#

I just updated from Unreal 4.18 to 4.25 and the problem seems to still exist there

sinful tree
#

The 99% on GPU would sort of be expected as it's going to try and push out as many frames as it can. What about your CPU usage?

bitter oriole
#

Well, that's normal

#

No framerate cap = burn at maximum hardware capability

#

CPU or GPU will be the limiting factor, usually GPU

raw quarry
#

I get that, but the CPU and frameate is totally fine

bitter oriole
#

Why wouldn't it ?

raw quarry
#

what is bizarre is that I dont understand why it would cause packet loss

sinful tree
#

Are you doing some replication during on tick events?

bitter oriole
#

Sending RPCs on tick, specifically

raw quarry
#

some things happen on tick, sure

#

even the core movement component unreal code happens on tick

bitter oriole
#

Are you sending RPCs on tick

#

Reliable ones in particular

raw quarry
#

yeah

sinful tree
#

Don't do that.

raw quarry
#

lol

bitter oriole
#

Well, never do that ever

#

You're murdering bandwidth

#

So packets get dropped

raw quarry
#

again, it only happens when framerate is uncapped. The blueprint tickrate is set and isn't affected by that

bitter oriole
#

Never do that ever

sinful tree
#

Tick rate is based on the frame rate.

raw quarry
#

It's not though...

#

not if the frameate is higher than I have it set in the blueprint

bitter oriole
#

For the performance side : GPU takes say 5ms per frame, CPU 1ms. Right ? Now you've removed the framerate cap, and you're now running at 200fps, GPU is at 100%; CPU is at 20% (200 frames per second, 200ms per second, 20%)

sinful tree
bitter oriole
#

And yeah, one frame = one tick

raw quarry
#

that's just not true..

#

you can set the time between blueprint ticks in the blueprint

sinful tree
#

It's in the engine dude.

bitter oriole
#

I guess you're the expert

#

Anyway

#

Put back the framerate limit

raw quarry
#

I do see your point about they shouldn't be reliable in tick ones though

bitter oriole
#

And never do reliable RPCs on tick

raw quarry
#

I'll see if I have any reliable ones, and remove that

sinful tree
#

Either way, if you need to replicate something frequently, you're better off setting a timer on begin play with a pre-defined delay on it, depending on how frequently it needs to be replicated.

raw quarry
#

ok sounds good

#

if I have reliable rpcs on tick with 0.0 between ticks, that would make sense that it's causing this

#

thanks for the help

#

didn't mean to be rude, if it came across that way

bitter oriole
#

Don't do reliable RPCs continuously, it's wrong

#

If it's a looping thing, it has to be unreliable

raw quarry
#

yeah I don't, but I may have one accidentally set

bitter oriole
#

Even if it's like 10 per second it's still terrible

raw quarry
#

actually, would changing a replicated variable on tick be just as bad?

bitter oriole
#

No

#

Replicated variables do not replicate when you change them

raw quarry
#

those aren't reliable?

#

ah

#

true

bitter oriole
#

They have their own rules

raw quarry
#

ok makes sense

bitter oriole
#

Reliable RPC means "send until receiver has confirmed reception, keep sending until that forever"

#

So any lag spike turns them into blocking events

raw quarry
#

yeah that totally makes sense

#

I'll see if I can find any that fit in that category

#

thanks!

bitter oriole
#

And seriously

#

Don't uncap framerate

#

People who love destroying their GPUs know how to uncap it themselves

raw quarry
#

well it's just a setting we expose in the settings menu

#

maybe it's a good idea to not allow uncapped at all

bitter oriole
#

I'd simply have framerate limit options set to reasonable values like 60, 120, 144

tidal crown
#

I have a dedicated Server that I am attempting to initialize/possses player characters post seamless travel I'm observing that an RPC that is meant for the server which spawns the character and tells the controller to posses the pawn is being called twice. This appears to happen because I'm attached to Event BeginPlay on the PlayerController, but what I can't figure out is why does the server log that that RPC is being called twice? The first time it fails, the second time it works.

fossil spoke
#

Most likely because both the Server and Owning Client are running the RPC.

tidal crown
#

thats probably true, how do I prevent this?