#multiplayer

1 messages Ā· Page 467 of 1

winged badger
#

as then you can carry over information in lobby PS/PC

#

and hint: when NotifyLoadedWorld/NotifyServerWorldLoaded is called on map A after travelling from map B

#

the controller class its called on is the one from map B

#

only after that does the GM switch the controllers

#

and all GM functions are virtual and/or blueprintnativeevents

west rapids
#

i see

#

ive never tried that before

#

but seems pretty efficient

#

thanks for the tip

winged badger
#

with PostLogin you're restricted to your login url string

#

with this you're restricted to whatever you put in your LobbyPC/PS

west rapids
#

ill give it a shot, might be better

#

thanks man

lapis oriole
#

Could someone tell which is a better approach for Amazon GameLift dedicated server hosting (or any dedicated server hosting service for the matter):

a) Integrate GameLift client sdk directly into the game and communicate with the server (make searching/joining session requests directly from the game client)
OR
b) Use a php web service (as i'm familiar with php) that acts a middleware between the GameLift server and the game client for communication (game asks the web service to search for sessions; service finds suitable session and sends the session info back to game client)

copper mango
#

having not done it myself, it seems that a) would be simpler than b), though I guess b gives you the option of switching to something else later

#

also b) adds another potential failure point to debug

#

also they have a plugin for that don't they?

lapis oriole
#

they have the server sdk plugin for ue4 but not the client, still looking into adding the gamelift client cpp library to ue4

#

"your client service" has me mixed up with the second option (amazon's gamelift game architecture they recommend).
Also read somewhere on forums that using a middleware service is more secure though it can add some latency

fluid prawn
#

Is there a difference between compressed flags and RPC? Should I pass input values as a compressed flag or an RPC?

#

examples being move forward right etc

copper mango
#

@fluid prawn like outside of normal CMC replication?

fluid prawn
#

Yes

#

I am currently trying to figure out some things with the CMC

#

I overrode it and did my own phys custom function that does custom accel friction jump gravity

#

now im trying to replicated it using UT replication style code

#

replicate*

idle flame
#

Hey,
Someone knows if I can I replicate a UObject pls ?

#

Or can I only replicate Actors ?

copper mango
#

you can replicate UObjects if they're owned by an actor

#

well, technically their outer is an actor

idle flame
#

@copper mango Thx, I have a last question.
I'm creating an ItemHandler that will hold all my items on both client & server side.
I want to create this ItemHandler on server and I want it to be replicated on all clients so that they know all the items that exist.

#

Should I use UObject or AActor as parent class for my ItemHandler ?

copper mango
#

like the items in the player's inventory?

idle flame
#

In inventory and also on the floor (in the world) or also in a chest

#

All the items that exist on the world

#

@copper mango Actually, I have an ItemHandler (a UObject) and a list of item in it (also inherit from UObject) and I would like to replicate all of this to my clients

copper mango
#

why does the client need to know about all the items that exist in the world? that's potentially also easy to hack because then the client knows what's in every chest

idle flame
#

@copper mango kk I see, I didnt think about that.
So, all my items should be only stored on server side ? and the player should have information only about his own inventory ?

copper mango
#

well, when the items are on the floor can the player see stats about the item?

#

like if they get close

idle flame
#

Actually he can because he has access to my ItemHandler

copper mango
#

ok so what I'd suggest, is like you have UItemInfo or whatever

idle flame
#

So he can have access to this information with the id of the item

copper mango
#

and it can either be owned by an Actor that's on the floor (representing the dropped thing)

#

which is replicated to client

#

or it's owned by a chest (which isn't replicated to client)

#

or it's in the PlayerState inventory (which is replicated)

#

I dunno if that's the best solution, but that's where I'd start

idle flame
#

@copper mango ok I'll do that thx,
But, if a player want for example to access a chest, the server will have to send this player all the informations about the items in it.
Is it a problem ?

copper mango
#

and you could make it so the PlayerState inventory is only replicated to autonomous proxy so you can't see what items the other players have

idle flame
#

@copper mango Thx a lot šŸ‘

copper mango
#

it's less data than sending all the items in the whole world to the player, so I think it's fine

#

could just be a client RPC when the player opens the chest

idle flame
#

Well true

copper mango
#

and the server just gives you a TArray of item infos or whatever

#

and then if you pick up an item, that's a client->server rpc saying you want to pick up item at index X in the chest, and then the server would add it to your playerstate which then gets replicated back to you

idle flame
#

@copper mango Well yes that's a lot better

#

Thx a lot !

copper mango
#

sure, good luck

idle flame
#

@copper mango Each Item I have own a list of components and each component inherit from UObject ( a component can be for example a name or dmg of a weapon or even ammo of a weapon ).
Did you think I should do that to store informations about my entities pls ?
I'm new to ue4 just want to know if I could store informations about each item in a better way

copper mango
#

so, if I have a gun item, it would have like a component for its name and a component for how much damage it does, and a component for the ammo count?

idle flame
#

yes

#

exactly

copper mango
#

does it need to be that complicated?

idle flame
#

I want to also use this system to store any type of entity (not only item).
But yes for the moment it don't need to be that complicated

copper mango
#

like you don't want to subclass Character and stuff like that?

idle flame
#

Why ? I should subclass Character ?

#

I have a class Character (C++) and a BP_Character.

#

But I don't have a subclass of Character should I have one ?

copper mango
#

well, BP_Character is a subclass, just in blueprint isntead of C++

#

what do you mean by "entity"?

idle flame
#

Everything that can be place in a world

#

and loot or drop by a player

copper mango
#

yeah, but then isn't a character an entity then too?

#

by that definition

#

and like a StaticMeshActor would be an entity too

idle flame
#

😬 true

copper mango
#

I think you'll end up fighting the engine a lot if you think of it in terms of entities and components

#

like, the engine does have components but they're actor components and they're much bigger functionality than mix-in components

#

like CharacterMoveComponent and such

#

well, they don't have to be big necessarily, but it's not really designed for like say an Actor to have 25 components

#

usually it's like 3-4 max

#

except for certain exceptions

idle flame
#

So I should use actor class for my items ?

copper mango
#

well, so like

#

the chest could be an Actor subclass

#

and it'd have static and/or skeletal mesh component (depending if you want to animate it)

#

and maybe a box component for collision detection

#

and then one of its properties coudl be your UItemInfo or whatever thing

#

in general, anything that's actually physically in the world should be a type of actor

idle flame
#

And I would create a component for the ammo of a weapon ?

#

When my item is in my inventory it should also be an actor ?

copper mango
#

when it's in the inventory, it probably doesn't have to be an actor

#

so basically the idea is your UItemInfo is the actual data representation of the item

#

and then the actor would be a physical manifestation of the item if it's say on the floor

#

or you're holding it in your hand

idle flame
#

Ok that's way more simple than what I actually have

#

But with actor how should I store for example the dmg of my weapon or it's amount of ammo ?

#

Would I have one class for each item I want to create ?

copper mango
#

normally you want to try to design it in a way so that there's a minimal number of C++ classes and then every different type is a data blueprint where you mostly are just changing data like mesh, fire rate, max ammo, etc.

#

so you might make a Gun class in C++ and then in blueprint make several blueprints for Pistol, Rifle, stuff like that

#

if you look at the shootergame example, you can see how they setup their items in an MP game

idle flame
#

That exactly the type of thing I was trying to figure out. Didn't know when to create a c++ or a blueprint

#

thx

copper mango
#

it really depends on how comfortable you are with C++, it's very possible to make reasonably functional games in just blueprint

#

but if you're doing MP you really probably want to do a decent amount of C++ for functionality, and then use blueprints to make data

idle flame
#

I'm quite comfortable with c++, that's why I was trying to make everyting in c++ but that's not a good thing to only use c++

#

MP ?

gleaming vector
#

you don't necissarily want a minimal number of C++ classes

#

i generally go about 80%C++ 20%bp

#

but making everything in C++ is the wrong way to go too

#

but the general idea is right, systems in C++, implementations in BP

idle flame
#

@gleaming vector That's what I also have 80%/20% I'm using bp only to link mesh and things like that or for UMG

#

@copper mango What did u mean by MP ?

copper mango
#

multiplayer

heavy marlin
#

does anyone know what the current guidance is for the online subsystem?

#

i mean does shootergame use it and is it up to date

fringe dove
#

anyone know why switching weapons on a player on the server in shooter game would cause 3 OnRep_AttachmentReplications instead of 2 on the client?

I expect one replication for the attach of the new weapon and one for the detach of the prev weapon
but instead it seems to get one for the new weapon, one for the detach of the old, and then another for the new weapon again with what appear to be the same exact values for AttachmentReplication's member variables as on the first attach

weak fog
#

anyone know if UE4 gives some kind of native "Teaming"? similar to how you get stuff like playerId for free on PlayerState

#

^for the attachments, I would think it's an implementation thing. maybe try checking the logs if you only detach + reattach on the same weapon, etc. stuff like that until the pattern emerges

wheat eagle
#

hi I'm having a problem that's right now that's keeping me away from continuing with the project: I have clients in a peer to peer session and the host is searching for a dedicated server session using Find Sessions Advanced in the Advanced sessions plugin. The thing is, when the host finds a session, incorporated in a "blueprint session result" variable, I can't find a way to pass this variable to the other clients from the ptp connection. I've tried through replication or simply sending it as parameter in a function, but the clients will always get the variable as NULL and therefore can't join the session. What am I supposed to do?

copper mango
#

@weak fog have to implement teams in that sense by yourself, there's teams for AI perception but that's not what you want

weak fog
#

gotcha gotcha. was just making sure i'm not doing undue work. thanks!

tardy cosmos
#

hi hi. Last day I tried my small project with a friend in a mp session. I got a lot of lag and it was really difficult to use it. We were running the game with the standalone version that you can open with Right Click on the main fail of the project (so not using the compiled version of the game). I was wondering, the netcode of unreal is efficient to have simple things with free lag right? Or is the online system bad by default?

copper mango
#

that's not normal, but if you run with "launch game" that version will be unoptimized

#

you have to package the game to get the optimized version

#

but if your game is simple it shouldn't be a big issue

tardy cosmos
#

thanks!

#

I will try

potent prairie
#

so i got this issue where if Player 1 has equipment attached (sockets/skeletal messhes, doesnt matter), and then Player 2 runs far away and comes back, Player 2 can no longer see the items on Player 1. But the items still show on Player 2. Is this a rendering distant issue thingy?

fossil spoke
#

Might be a net relevance issue?

#

Make sure BeginPlay isnt messing with them, BeginPlay is called again each time an Actor becomes net relevant.

wheat eagle
#

hey guys quick question: Where should I do general things like initializing the steam api and calling global functions for my game? I was thinking about the game instance class, but I want to be sure. How do you guys do it?

potent prairie
#

Ah okay thanks Devils Ill look into that

fleet viper
#

Does somebody know what could've gone wrong when the match state in gamestate returns aborted?

fossil spoke
#

@wheat eagle GameInstance is a good place for that.

meager spade
#

thats where we handle it

fossil spoke
#
/** Possible state of the current match, where a match is all the gameplay that happens on a single map */
namespace MatchState
{
    extern ENGINE_API const FName EnteringMap;            // We are entering this map, actors are not yet ticking
    extern ENGINE_API const FName WaitingToStart;        // Actors are ticking, but the match has not yet started
    extern ENGINE_API const FName InProgress;            // Normal gameplay is occurring. Specific games will have their own state machine inside this state
    extern ENGINE_API const FName WaitingPostMatch;        // Match has ended so we aren't accepting new players, but actors are still ticking
    extern ENGINE_API const FName LeavingMap;            // We are transitioning out of the map to another location
    extern ENGINE_API const FName Aborted;                // Match has failed due to network issues or other problems, cannot continue

    // If a game needs to add additional states, you may need to override HasMatchStarted and HasMatchEnded to deal with the new states
    // Do not add any states before WaitingToStart or after WaitingPostMatch
}

@fleet viper

#

Could be a network issue

#
// Called when a player is disconnecting due to network failure
DEFINE_GAME_DELEGATE(HandleDisconnectDelegate);
#

There you go

#

Apparently its called by this delegate.

fleet viper
#

someone ran into this issue before, luckily it runs fine in a packaged build

potent prairie
#

well I got armor and such to remain attached when other players come in and out of render, but not weapons. Basically anything that is attaching to sockets and going thru a multicast seems to not keep the sockets updated if other players get too far out of view. Not sure how to solve

chrome bay
#

use replication instead

#

RPC's should be for fire-and-forget stuff

#

variables should be used for persistent states

#

once your object goes out of relevancy range it gets destroyed

#

so whatever you've done with RPC's will be undone

potent prairie
#

How would I replicate an attach to socket?

#

a multicast isnt the right way then because thats an RPC

#

RepNotify or something?

chrome bay
#

Yeah

#

I meant, assuming the weapon is an actor, normally it would just replicate it's attachment via rep movement

potent prairie
#

yes its an actor, so I need to enable rep movement, and then attach with a repnotify?

chrome bay
#

If you enable rep movement it will attach automatically

#

But it depends on the game as to whether you want to pay the rep movement cost

potent prairie
#

okay

#

would there be a way to update its socket location only when other players come into view or something?

chrome bay
#

in our game if the weapon is equipped, we just attach to a known socket. no need to rep any extra info

#

well it's driven by the server

#

so when it all replicates / is created from replication it should just attach itself

potent prairie
#

okay so no need for this multicast

chrome bay
#

shouldn't be

potent prairie
#

I can attach it on my server function and it should replicate right

chrome bay
#

yeah if the weapon replicates movement

potent prairie
#

ok

chrome bay
#

I'd suggest making the weapon use Net Owner relevancy as well

potent prairie
#

alright

#

thanks ill give this a go

chrome bay
#

if in doubt, look at shooter games' setup. that's a pretty common approach

potent prairie
#

hmm still teleporting onto the players root

#

its good as long as the players are close

#

but once you run away out of distance then come back its off the socket

#

no more multicast though

#

hold on gonna try a notify really quick

#

fuk still didnt work

#

im stumped

potent prairie
#

okay so what's happening is when the player is far enough away, the other players are deleted/culled/whatever. and the attached weapon is getting deleted with it (for that 1 player who's far away)

#

when I come back into range, the players are no longer culled, but the weapons arent brought back with them. so I dunno how to fix that

meager spade
#

@chrome bay do you have the bones updating on the server?

chrome bay
#

not in HLL

#

no anims on server there

potent prairie
#

hey i fixed it by setting the player characters to be Always Relevant. Not sure if thats ideal but ill keep it on until i find another solution

idle flame
#

Hey,
I'm trying to use RPCs. My server invoke the rpc but I want to run this call only on a specific client.
The ue4 docs say that my server need to call this rpc from a client owned actor. But the only client owned actor I have is my player controller.
I would like to avoid creating function in my player controller class that have no reason to be in this controller class

#

How would I call a rpc from server to a specific client without creating the function in my player controller ?

rotund sapphire
#

I think the PC is the only thing you can address specifically, that is the representation of the client from the perspective of the server.

twin juniper
#

Can someone point me in the right direction on how to save player information on a server (as in, a storage server that I rent from amazon or something). I know I can save to a file using the save game object, do I then upload that file somehow to the storage server, or is there a different process? Im new to all of this, thank you

idle flame
#

@rotund sapphire id the only way is to use PC, do you know if I can somehow separate my code within my PC class ? Is it possible to use actor component for that ?

rotund sapphire
#

I can't think of a reason why wouldnt that work. Do you have issues with an AC?

idle flame
#

@rotund sapphire no All work fine now šŸ‘ thx

fringe dove
#

@chrome bay @potent prairie I think it will replicate the attachment regardless of rep movement right? Was just looking into this same thing because I'm seeing extra OnRep for attachment in shootergame that I don't understand yet:

void AActor::GatherCurrentMovement()
{
    if (bReplicateMovement || (RootComponent && RootComponent->GetAttachParent()))```
#

and:


void AActor::DetachRootComponentFromParent(bool bMaintainWorldPosition)
{
    if(RootComponent)
    {
PRAGMA_DISABLE_DEPRECATION_WARNINGS
        RootComponent->DetachFromParent(bMaintainWorldPosition);
PRAGMA_ENABLE_DEPRECATION_WARNINGS

        // Clear AttachmentReplication struct
        AttachmentReplication = FRepAttachment();
    }
}```
#

both seem to be able to run regardless of bReplicateMovement unless something else is keeping changes from going out with a rep condition or something

fringe dove
#

shooter game does do its own replication in addition, because only the root component of a replicated actor's attachment is automatically replicated, and the third person weapon mesh other players see needs a separate attachment to the third person character mesh

raw quarry
#

does anybody know if the gameplay ability system uses the movement component saved moves?

#

does anybody know if the gameplay ability system uses the movement component saved moves?

#

I'm worried it won't do proper client prediction

thick shale
#

@raw quarry as far as I know, if you're talking about the root motion tasks, it does and was working in 4.19, but as of 4.20 it seems to have issues with prediction.
some of the folks in the #gameplay-ability-system channel have reported it, and are waiting on a response back.

raw quarry
#

ok thanks!

fringe dove
#

is it possible to replicate a component to everyone but the actor the component is part of's owner?

#

I know there is skipowner on replicated variables but I didn't know about with a component that is bReplicates

meager spade
#

skipowner wont replicate it back to owner

#

not sure if it works with Replicates

#

you might need to handle that seperatly

#

not sure if the component has some replication settings

winged badger
#

that condition is for variables

#

there are ways to work around it though

#

and spawn it, locally, on everyone except the owner

#

you'll still be able to reference it over network

#

SetNetAddressable(true) call on the thing

#

and exactly the same name on all machines

#

as for RPCs running through it, if owner doesn't have it, it doesn't matter so thats fine

#

it will not be able to replicate any variables inside of it tho

twin juniper
#

Anybody got any ideas regarding my question that I asked a few hours ago?

meager spade
#

@twin juniper best to save it some kinda database

#

serialize and store on server

#

using some kinda REST protocol or something

twin juniper
#

Yeah I understand that part, but since I know nothing about this, what exactly do I need to learn

#

will I have to do coding in php or some language like that?

#

Just trying to find some guide or tutorial on how to go about all of this, since this is all new territory for me

idle flame
#

Hey,
I'm replicating a struct that is within an actor.
This struct contain a UObject and this UObject is create on server side.
Someone know why when this struct is replicate to client the UObject in my struct is always nullptr pls ? Is it normal ?

ocean geyser
#

what is a good way to test your game that is connected via steam multiplayer? currently if i want to test something i have to package the game, put it on another pc and join the host pc. is there an easy way to test without doing all of that such as sticking to only one pc?

granite peak
#

you can set the number of players in the drop-down menu next to the play button and change the play mode to run in New Editor Window (PIE)

#

and then in advanced settings from that menu u uncheck Use Single Process i think

ocean geyser
#

derp, didnt think to try that but that seems to work along with misc functions in the game mode like post login, thank you

granite peak
#

standalone game also works i thiiink im not that sure lmao i'm pretty new to this stuff

ocean geyser
#

for some reason i had issues testing in standalone using lan settings. the server appeared but it failed to join which may make for some frustrating issues later on but that will be dealt with lol

granite peak
#

So essentially two cases (so far) where this fails:

  1. mid-wallrunning when the client suddenly fails to stick to the wall
  2. attempting to stick to the wall but fails to do so when the EndOverlap is suddenly triggered even though the overlap collider is still overlapping the wall (this is evidenced by the fact that when the client actually leaves teh wall the LEFT WALL message appears again, leaving two of such messages)
#

i'm currently updating to UE4 4.22.2 to see if this changes anything assuming the first case is a weird bug with ue4 4.20

idle flame
#

Someone know it possible to replicate UObject in ue4 ? I’m trying to replicate a UObject stored in an actor.

#

My object is not null on server side but it’s null on client side

copper mango
idle flame
#

@copper mango thx ^^

fluid prawn
#

Question for you guys I'm having issues figuring out why when I set 2 Players the client does not spawn but the server only possess. I get something that looks like this

#

when i spawn three characters it's fine? I've tried Actor offsets, I've tried adjusting collisions no success

twin juniper
#

@fluid prawn try adding more playerstarts in teh scene if u only have one

fluid prawn
#

I've added two

#

seems to not work but if I do three player starts it works

#

for some odd reason it wont work for two players

#

three player start for three players it works*

twin juniper
#

What if you run as dedicated server, does 3 player or 2 or even 1 work?

fluid prawn
#

if dedicated is on

#

neither do

lone vapor
#

How are you choosing spawn points?

fluid prawn
#

I am just using the player start

twin juniper
#

Did you override game mode functions?

fluid prawn
#

no i did not override the game mode I tried my own and the default

lone vapor
#

i would just try adding like 10 spawn points and see if you can still reproduce the issue

#

i had the same issue with my multiplayer project and it was because 2 clients were trying to use the same spawn point

#

i added a method to delete the playerstart actor after it was used (works for a 4 player coop game), which completely resolved the issue

fluid prawn
#

hmm

#

I should just override my own game mode and do the spawning from scratch

past rain
#

if there are 2 playerstarts, and you are spawning 2 clients, they should automatically select 2 different playerstarts, not the same

bronze arch
#

if someone talk with me, mention me please

#

im confusing now

fluid prawn
#

@past rain that's what I thought aswell

twin juniper
#

Create a new project

#

See if it works fine there

#

if it does, then you must have changed something

#

that messed it up

lone vapor
#

if there are 2 playerstarts, and you are spawning 2 clients, they should automatically select 2 different playerstarts, not the same
Would that not only be the case if the clients manage to be created at the exact same time?
If you do a server travel to load your map then clients wouldn't join in at the exact same time right?
Could only be a single frame difference but I would imagine that would then allow 2 clients to try and use the same spawn point.

twin juniper
#

That's true, but regardless it doesnt look like the issue is playerstart, if two clients spawn in the same playerstart they will both still spawn

#

in his case the clients arent possessing anything

lone vapor
#

I had the same issue, it wouldn't possess because it didn't finish spawning properly

#

May have just been the screwy way i was spawning people in though /shrug 😃

twin juniper
#

Most likely, by default this shouldnt be an issue

#

Especially if you arent overriding functions that has to do with spawning

#

By default the game mode comes with the spawning working

fluid prawn
#

yeah I'm curious why its like this

#

i just tried default game mode

#

with just a regular pawn

#

seems to still spawn the mesh on the player start

#

but the camera is still under the map and not possessed. Like i mentioned earlier if I do 3 players it possesses properly

#

makes no sense

ocean geyser
fluid prawn
#

like so.

#
// set default pawn class to our Blueprinted character
static ConstructorHelpers::FClassFinder<APawn> PlayerPawnClassFinder(TEXT("/Game/FirstPersonCPP/Blueprints/BP_FirstPersonCharacter"));
DefaultPawnClass = PlayerPawnClassFinder.Class;
#

I've tried that also. I made a Game mode BP and set the class to my game mode and then went into the game mode override and set the default pawn

#

still no avail

#

I'm writing some spawn point code to see if it works

#

I'll post it in here for those who might need it

fluid prawn
#

making progress

fringe dove
#

is there any kind of callback on the client when the server makes it an owner of a replicated actor?

#

I guess you can override SetOwner, but that won't catch replicated changes, so also override OnRep_Owner?

fluid prawn
#

I think that's possible

#

so I found out what the issue could be but not sure how to solve it yet

#

So for example if I run my own game mode with the default boiler plate code generated from first person c++ class it will set my default BP_FirstPersonCharacter but the other clients are just floating around like they are in spectator mode but not possessing anything. So I tested something interesting I set my BP_CustomGame mode to the default game mode class instead of the boiler plate one. I can actually see from the clients perspective the server moving around but still the clients are still not possessing anything. It seems that the issue lieing with the game mode

#

Also this might be the issue but I am using my own Custom Movement component Class.. I just made a child class of the default one so I can add my own custom movement type. That could also be part of the issue.

winged badger
#

@fringe dove yes, that is the way to go about it

viral raft
copper mango
#

@viral raft can you explain what you're trying to do without the blueprints? like just at a high level

mint jolt
#

followup to my "my controller looks corrupted" question from the other day: turns out when a remote client connects to the listen server, the server makes them a pawn, which is then momentarily possessed by the server's pawn's controller before being possessed by the new client's controller. not sure yet if this is a bug in 4.20 or in our code.

winged badger
#

if you overrode anything in the GameMode, and used GetPlayerController[0], probably

wheat eagle
#

hello people I have a problem: I'm trying to make stats for my game using the steam api. When setting the stats for my game in the Steamworks admin panel, it is an option which asks whether the GS(game server) or the client will store the stat. At first of course that I selected GS and I tried making the code for sending stats server sided. 4 hours pass by, i don't achieve anything because I can't make particular things work and now I'm angry as hell and considering leaving the "Client" option for the stats as I already have the code for clientside. My question is: is storing the stats client-sided dangerous and vulnerable to hacking?

twin juniper
#

If its stored client side then the client can alternate the stats, so yes

viral raft
#

@copper mango I am trying to teleport a player (server or client)

#

But when trying to teleport the server i get this error:Warning: UNetDriver::ProcessRemoteFunction: No owning connection for actor EscaposCharacter_C_1. Function Teleport Server will not be processed.

#

Teleport server also doesnt get fired on when the server needs to get teleported

wheat eagle
#

@twin juniper sorry , I realised I asked the question in a wrong manner. The server sends the client the stats modified server side and all the client does is sending it to the stats server through steam api functions(the client doesn't actually set any variable, they just send it). Is it still vulnerable if it is done like this?

twin juniper
#

If the client doesn't have the opportunity to modify the stats, then I don't see the issue with it. Seems safe enough to me, although Im no expert, @wheat eagle

copper mango
#

@viral raft oh, if EscaposCharacter is not controlled by the local player, you can't send a server RPC to the server on that character, if that's what you're doing

#

you'd have to send a server RPC on like your current player controller to tell the server to teleport the other player

grizzled stirrup
#

Is there any way for a listen server host to just create a dedicated server behind the scenes and connect to it along with any other clients?

#

So he'd still be hosting but without the potential issues a listen server brings (like choppy client interp when viewed from the perspective of the server). Dedis make it so much more even- everyone is having the same experience- much easier to test

#

Similar to PIE with dedicated server checked

copper mango
#

don't think that's built in, but if you followed the PIE code path for it maybe you could emulate it

twin juniper
#

Feels like it would be best to sit down and learn how to implement interp, as it would save a lot of headache in the future

#

Would make making multiplayer games easier

wheat eagle
#

@twin juniper eventually I managed to make the delivery of the stats properly and server sided 100%. Thanks for your answer though.

twin juniper
#

@wheat eagle pm'd you

ornate crescent
#

Hi, i need approach or advice if i'm doing well or if thinks it's wrong.
I create ItemWeapon like Struct, with Name item, damage, hitpoints and Statics mesh (for equip) and my character have one Struct CharacterEquipment, with have

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Weapon)
    FDOWeaponItem MainHand;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Weapon)
    FDOWeaponItem OffHand;

Work with this approach is good?
This is for Online game

twin juniper
#

@ornate crescent Pretty sure this is how they do it in the Shooter example project

#

where the weapons have a struct with all the info in it

ornate crescent
#

yeah, but in my game, the player can be disarm. so.... the MainHand is weapon

#

is empty sorry

twin juniper
#

In the shooter project you can change weapon

#

Which is the same as disarming then rearming

#

Definitely worth taking a look at how they did it there

ornate crescent
#

yeah, but is MainHand = OtherItem, not way to detect if is empty

#

i'm going to take a look to the shooter example

#

thanks @twin juniper

twin juniper
#

šŸŒž

ornate crescent
#

shooter game use actor

#

TArray<class AShooterWeapon*> Inventory;

#

/** currently equipped weapon /
UPROPERTY(Transient, ReplicatedUsing = OnRep_CurrentWeapon)
class AShooterWeapon
CurrentWeapon;

twin juniper
#

Yes. I'd make a class out of the weapon

#

and give it to the character

#

Thats the way I do it too

ornate crescent
#

yeah but i have a Inventory System, with character with Equipment

#

all items in Inventory (i think) is best choice is use struct

#

but for Equipment i try with Struct but i think i change to AActor and add Iteminfo to the actor

twin juniper
#

@ornate crescent The weapon inventory should be a struct of Weapon no?

ornate crescent
#
TArray<FDOItem> Inventory;
#

this is array of structs of Items in the inventory of player, have all information about the items

#

and Character have a Struct (CharacterEquipment) with each slot for equip items

#

in the CharacterEquipment each items are Struct, now i change to Actor with this Actor have the ItemInfo and spawn the mesh in the character socket

idle flame
copper mango
#

@idle flame if it's the player-controlled character (autonomous proxy) that counts as "owned by invoking client" so it does call a server RPC on it

idle flame
#

@copper mango Ok thx didnt know that

copper mango
#

but only for the player who's local to it

#

so like player 2 can't call a server function on player 1's character

idle flame
#

yes seems obvious xD thx

viral raft
#

@copper mango it is controlled by the local player

sick holly
copper mango
#

in theory it's possible, but I doubt it would be easy to convert the project to work with MP. you'd probably have to rewrite it from scratch with networking in mind

ember needle
#

How can you get the local player character inside of another player state?

meager spade
#

not possible

#

its not replicated

ember needle
#

ah

#

?

meager spade
#

a client cant get another clients playercharacter

#

from playerstate

#
    UPROPERTY(BlueprintReadOnly, Category=PlayerState, meta=(AllowPrivateAccess="true"))
    APawn* PawnPrivate;```
ember needle
#

Ok let me rephrase to ensure that

meager spade
#

server can get it, no sweat

#
    APawn* GetPawn() const { return PawnPrivate; }```
ember needle
meager spade
#

the first player character at index 0 in the array

ember needle
#

i was hoping for the local player

meager spade
#

but

#

i never trust it

ember needle
#

so here's the thing: i have a replicated SlotID on player state that defines which player slot they use (role inside the game). I need to MUTE all players that are NOT of the same team, so when the SlotID gets replicated, I need somehow to check whether this means that the player associated to the state that got replicated is NOT in the same team as the local player

meager spade
#

bp or c++?

ember needle
#

BP

#

but can adapt

meager spade
#

how are you checking for teams?

#

i mean GetPlayerCharacter should work

#

to return the local pawn

ember needle
#

this is the kind of madness i'm into rn

meager spade
#

but i had issues with it on dedicated server

#

eek

ember needle
#

I know, right.

#

well i don't see alternatives, which is unfortunate

#

the PS SlotID gets replicated at different times obviously

#

this get called OnRep of SlotID

#

basically: get the Team from the LOCAL character, then compare it to the just replicated SlotID of this Player State. If NOT in the same range of the team, then mute player of the player state.

#

What I get: the LOCAL character gets muted (?!)

#

so obviously i'm doing something wrong

ember needle
#

so: if i try this locally with "Launch Game" it works (2 instances). If I try this online with another tester, every player mutes themselves.

#

Any ideas? Really stuck here.

naive crater
#

You're in the player state?

#

have you tried using get pawn private ?

meager spade
#

its not BP exposed

naive crater
#

If that doesn't work for you, you can always have your controller send your player state your current pawn

vivid seal
#

Having an issue with dynamically spawned actors where unless I set Always Relevant to true, they don’t seem to exist on some clients despite all the players and the spawned actor being right next to each other (not a net cull distance issue basically)

ember needle
#

@naive crater thank you but I don't need the pawn controlled by the player state, I need the pawn of the local player

meager spade
#

@ember needle just use GetPlayerCharacter node

#

it should be ok

ember needle
#

ok thanks, then my problem is elsewhere even though I don't get it

copper grove
#

@ember needle how are you bringing your players into the world, cant you just store player / assign player ids in the game mode on the server when they enter the world and then group them/organize based on the team.. when i spawn players into the game world i always assign them an ID that i have control over .. that should be really easy to check what team they are on like that

ornate crescent
#

i'm still confuse about how to manage my player equipment, if any can help me.
I have a inventory is TArray<FItem> Inventory which FItem is a Struct for every item information (ItemId, itemname and StaticsMeshComponent)
My Character have , example, Weapon. my first approach is this weapon like
FItem MainHand;

But is not the best solution,because if i unequip the weapon, the Fitem struct still stay (i need to set all to 0) . I think this is no the best approach so i think the next solution

Create Actor like AGearActor with this actor have

FItem ItemInfo;
StaticMeshComponent* ItemMesh;

I think this is best approach... but... for this game all equipment are only visual, all logic is only numbers, don't need collision and nothing.
Is the best approach AActor with replication or other approach?

#

Equipment is only for visual, no need collision and nothing more, only show the MeshCompoentn in the character. The logic in the game is only get the ItemInfo to know the damage, range and hitpoints

opaque forge
#

Is it possible to make a player controller that records all it's movements like a demo, but can be played back via an AI controller that still controlling an active pawn that can be interfered with? I know the replay system records replication data, so I wonder if you could play that back server side as a virtual client.

meager spade
#

you could just store the movements yourself

#

and replay, sure

#

you could just store movement inputs from the player

#

and have the ai apply the same movement vectors

opaque forge
#

What about slight inaccuracies in the movement though. If that is the case, even a centimeter difference in parameters could throw the replay completely off

meager spade
#

well if the player is moving then the ai will simply retrace his footsteps

#

no?>

opaque forge
#

@meager spade What if there's a small discrepancy in the variables of the map that cause the recording to become unsynced? Physics need to still be run so that players can purposefully interfere.

unreal pine
#

Hey friends - I'm having clientside animation jitter I've verified that client and server are both returning the proper move speed for the pawn in question. This capture is from a client, the server owned pawn is moving smoothly, but the client's pawn still jitters when moving. https://gfycat.com/EachFineGosling
Anyone have / solve this problem before?

twin juniper
#

@unreal pine I assume this is when a player is hosting right?

#

And you're using the character class?

plucky horizon
#

If I have a child actor on an actor already set to replicate, then obviously the client's replicated version will have a child actor spawned for it..
but.. what if I set the child actor to also replicate.. will the client now have two instances of that actor? One attached to the parent, and one detached?

winged badger
#

unreal should be smarter then that

#

having said that i usually void using ChildActorComponents

plucky horizon
#

"should" instills much confidence in me

winged badger
#

*avoid

#

it will not spawn 2 replicated components

plucky horizon
#

I guess I'll have to test

winged badger
#

but its easy enough to test

plucky horizon
#

well no, but one of them might not be a child actor component

winged badger
#

set the outliner to view client's world and see if you have an extra child actor

plucky horizon
#

it might just be the actor

winged badger
#

empty level, no distractions

plucky horizon
#

mmm my levels are pretty barebones

winged badger
#

you put one instance of the parent actor in

#

see if you have 1 child actor on server and 2 on client

plucky horizon
#

I'm just at home write some of the C++ code. I'll have to see about the testing when I'm in the office

winged badger
#

i really doubt you will

vivid seal
#

I’m not sure why but I fixed a similar issue by making sure that ā€œcomponent replicatesā€ was turned off in the character movement component on my character.

winged badger
#

i mean, when unreal replicated an asset with full path

#

it creates a NetGUID after the first replication so it doesn't have to send long strings

#

for example

#

it would surprise me they covered that but failed so miserably on child actors

plucky horizon
#

I guess I'll write the code with the assumption it's gonna work correctly

#

Oh I guess one more question for you since you're here =)
Do replicated properties do so only when they are updated? or is it tick based? Or a combination?

winged badger
#

the netdriver will evaluate the replication per actor, during its "net tick" and its in quoted because that technically doesn't exist

#

its NetUpdateFrequency times per second

#

if something in the RepLayout changed, it will replicate changes, if it hasn't, nothing will be sent

#

nothing will be sent if its dormant, fails relevancy check...

#

replicating is evaluated per actor per DataChannel (one per PlayerController)

plucky horizon
#

hmm half that is over my head

winged badger
#

so if you change a replicated property

plucky horizon
#

I think I'll read as something like: if something changes everything will be sent

winged badger
#

it will be sent the next time Actor is evaluated for replication

plucky horizon
#

oh ok

winged badger
#

how often that is depends on NetUpdateFrequency

#

it is a good practice for Actors that have important replicated variables that don't change often to keep the NetUpdateFrequency low

#

and call ForceNetUpdate after you set the variable server side

plucky horizon
#

oh interesting

winged badger
#

it will push the Actor into the replication bucket for that frame

plucky horizon
#

what units is the frequency member?

winged badger
#

ofc, if used too liberally, same as Reliable RPCs, the technique loses all its benefits

#

Hertz

plucky horizon
#

okay, any other wisdom to impart?

#

thanks for the help

ember needle
#

@copper grove player state is where i store the SlotID, seems the right place... Will try alternative routes if this doesn’t pan out

winged badger
#

i did flag that comment as unfortunate as soon as i saw it

#

PS doesn't control anything

#

but if that is a local player's PS, that variable does hold local Pawn

sharp pagoda
#

Hey folks, having some networking issues related to ownership, and I found out that the game mode never SetOwner()'s the spawned pawn to be the player controller? Is there a reason for that? Currently I'm doing it manually in a game mode derivative.

wraith granite
#

Hey guys! Does anyone know if I can replicate an object to a specific client only, so the object would only exist for a server and one spicific client?

meager spade
#

mark it relevant to owner only

unreal pine
#

@twin juniper I assume this is when a player is hosting right?
Yes, but happens on a dedicated server as well - just wanted to show how a server side character's animation looks smooth as opposed to the client

winged badger
#

@sharp pagoda it does that inside the Possess function

sharp pagoda
#

Ah found it, thanks

unreal pine
#

actually - I found where that animation jitter is happening. Can someone sanity check me here? What's a safe range to stay in for listen servers?

#

This is on the character movement components

#

I started pretty extreme just so I could verify that was the correct variable I needed to change

#

for now, I'm just gonna keep dialing back until it looks bad again, then test over steam

wraith granite
#

@meager spade Thank you. I already found out about it myself. But now I met another problem. The object simply doesn't replicate at all, when I have this checkbox checked. I create an object on the server, assigning the ownership to the specific client, but the object spawn only on the server. If I uncheck the box, the object replicates to all the clients, as expected.

echo pond
#

hey, is there a way to check what is distance between client and server position? basically it sometimes happen to me that I start playing animation and my character slides slightly, but character movement doesn't change velocity so I assume this is due to smoothing

copper mango
#

you can turn on p.NetShowCorrections 1 and then it'll show you when there's a discrepancy between the local client and what the server expects

echo pond
#

will certainly try it out, any idea how to stop the sliding if this is the case?

copper mango
#

I don't think the smoothing functions get called on the autonomous proxy path, I believe those are only for simulated proxies

echo pond
#

it's simulated proxy

copper mango
#

oh

echo pond
#

yea would be slightly easier :D

copper mango
#

so the problem is if local player A starts playing the animation and then that's RPC'd to server and then to player B, and player B gets corrections but player A doesn't?

echo pond
#

well it's AI so BT calls play animation, client side AI waits till it stops (based on velocity) and plays the animation, RPC is only called to sync that client should play animation when character starts

#

everything works ok, AI played animation no issues, but right as it stops, it also slides a little, it's more of a visual hiccup that is annoying living hell out of me

copper mango
#

ah

#

so it's almost like the animation ends slightly earlier on the server (which makes sense), and then the server AI controller sends another move input after that, and then your simulated proxy has both the montage playing and the first move after the montage at the same time? maybe?

echo pond
#

hm I think that would just override the montage, but no this happens pretty much when AI stops moving and starts playing animation

#

and seems to be more pronounced in standalone if that helps anyting

copper mango
#

oh so it's on the start of the animation, not the end?

echo pond
#

not standalone, when I uncheck Use Single Process

#

yup

copper mango
#

so then it's like the simulated proxy code thinks it's still moving, but then it receives from the server "hey you're playing the montage and at this timestamp" and that's where it glitches?

echo pond
#

hm simulated proxy starts playing montage the moment when its CMC velocity is zero (or close to zero)

#

my thought is that while CMC says AI stopped, smoothing might be taking over trying to correct the position to correspond with that on the server, but it doesn't do it through velocity?

copper mango
#

hmm, I'm not sure, I haven't looked at the move smoothing code really yet

echo pond
#

that's fair :)

#

ah well back to deep diving into guts of the engine, thanks for trying anyway

unreal pine
#

dude that p.NetShowCorrections 1 actually helps me a lot right now too šŸ˜„

#

I'm still getting that weird animation jitter, but at least I know it's not the server correcting the client now

#

weird that Listen Server Network Simulated Smooth location/rotation Time variable is making a difference of how that animation jitters on the client and server though

echo pond
#

I think I was battling with similar issue few months back

#

but I haven't really read what you wrote yet so gimme a moment :)

unreal pine
#

oh, it was a little while ago

#

Hey friends - I'm having clientside animation jitter I've verified that client and server are both returning the proper move speed for the pawn in question. This capture is from a client, the server owned pawn is moving smoothly, but the client's pawn still jitters when moving. https://gfycat.com/EachFineGosling
Anyone have / solve this problem before?

#

what I found, was that lowering the Listen Server Network Simulated Smooth Location Time to .005 made everything look great clientside

#

but server side it made it worse

#

which is weird

echo pond
#

what's your network no smooth update distance, and network large correction distance in CMC? I think increasing those values solved most of the issues for me

unreal pine
#

yeah I actually changed those a lot for testing purposes

#

one sec

copper mango
#

if you force dedicated server does it fix it?

unreal pine
#

no, it actually makes client to client prediction worse lol

#

like worse than server to client or client to server

echo pond
#

try to just change that 15.0 to something bigger

#

100 worked for me heh

unreal pine
#

right on, I'll give 'er a try

echo pond
#

and uh...times...0.05 will pretty much just snap rotation, so maybe increasing it might improve the...smoothing experience? I feel there's something wrong with me saying that :D

#

@copper mango yeah ok seems smoothing just straight away sets new location and rotation rather than moving actor through CMC, makes sense I guess

unreal pine
#

I feel like the client shouldn't be jittering on the server ever, since it has authority on its position, right?

echo pond
#

is it autonomous proxy?

unreal pine
#

I don't know 😬

echo pond
#

hh is it AI? :D

unreal pine
#

oh lol

#

nah

echo pond
#

is it player that is owned by that client?

unreal pine
#

it's not owned by the server I guess

#

but the server has authority on it moving, right?

echo pond
#

likely no, if it's autonomous it means that some client owns it and server should replicate movement to other clients, but it takes position from client

#

if it's simulated proxy (AI most often) then it lives on server and server has authority on what it does

#

you can actually check it, AActor should have property Role :)

#

might help you figure out who is in charge of what

unreal pine
#

hmm I see I thought inputs came in through the client, and the server called the add movement to that pawn or whatnot

echo pond
#

might be don't take my word for it, I mostly deal with AI

#

so never really worked with autonomous proxies

copper mango
#

on autonomous proxy with CMC, the local client executes the move locally and then at some point sends move(s) to the server, the server validates for the client timestamp and then sends back corrections if it thinks something's worng

unreal pine
#

ok - that makes more sense that there's position jitter on the server as well now

#

but shouldn't p.NetShowCorrections 1 be lighting up my screen whenever the animation jitters then?

copper mango
#

that only shows something if the server decides the client's wrong and sends a correction

unreal pine
#

ah, so that's considered a normal update for the server

copper mango
#

are you sure it's not a problem with your animation blueprint?

#

cause you're not moving that fast where it should look that bad

unreal pine
#

if it's an issue with the animBP, wouldn't it be having problems for the server's pawn on the server?

#

If you have a moment, I can screen share with you and show you the problem

echo pond
#

you wouldn't happen to have some weird avoidance on huh?

unreal pine
#

not really sure what that means

#

but no, I'm not really doing anything fancy for setting position

copper mango
#

how are you moving the autonomous proxy locally?

#

just with apply movement input?

#

er, AddMovementInput

echo pond
#

well I had to try :)

unreal pine
#

yes

#

and because I have multiple instances of unreal that launch to test replication, I'm able to control both with the same controller

#

so the input is being called on the actual client

copper mango
#

how much simulated packet lag were you using in that gif?

unreal pine
#

you can do that? lol I'm not sure

#

is that in the launch / multiplayer settings?

copper mango
#

nah in the console

#

Net PktLag=number

#

by default it's 0

#

so you definitely have something abnormal going on if it looks that bad with 0 packet lag

unreal pine
#

yep, then I'm using 0

echo pond
#

do you use blendspace for running?

#

like from idle to run

unreal pine
#

I do

#

@copper mango I tried setting that packetlag, and p.NetShowCorrections 1 will absolutely light up my screen with issues related to client/server

echo pond
#

and you blend it based on the speed?

#

that I assume would come from CMC velocity?

unreal pine
#

@echo pond it's set as the max walk speed on the CMC

#

oh yeah nah you right

#

yes, it's set from the current move speed I'm sure

echo pond
#

so try to change it that if you don't run it's 0 and if you do run it's max, just for test, see if it still jitters

unreal pine
#

yeah, I'm setting it to a static value

echo pond
#

also I'm not sure you are running listener server :)

unreal pine
#

nope, still about the same

#

I'm definitely running a listen server

#

but still have issues with a dedicated

echo pond
#

uuhm I think you either have on or the other no?

unreal pine
#

I mean, it's a checkbox

#

I can test both

echo pond
#

aaah ok, I misunderstood

fleet raven
#

do all replicated properties of a new replicated actor get sent with the initial bunch?

unreal pine
#

I think so, unless you have a replication condition that excludes the initial replication

echo pond
#

Where's that?

unreal pine
#

that's an option for any variable in blueprint

echo pond
#

ah good to know, thx

copper grove
#

so , when making a server-client type game, without a dedicated server, the server being an actual player, how do you prevent the server from cheating, is it at all possible? would you send some occasional data to all the clients and check for mismatches?

#

bitcoin

#

isnt that kinda how they make it, they verify data among multiple users

#

this was a really good read, kinda answered my question along with searching here for "server cheating" https://www.gamedev.net/forums/topic/690731-do-i-really-need-a-server-to-prevent-cheating-and-ensure-state-consistency-in-simple-games/

safe marsh
#

hey, I have a moving platform, I dont want to replicate its position ebcause there is too much jitter

#

when a new client connects, the platform isnt moving, because the event has fired on the server before they have connected. how do I update the client version of the actor to have the same state as the servers

lone vapor
#

how do I update the client version of the actor to have the same state as the servers
That is replication, right?

If the issue is that its jittering I wonder if you could instead of replicating the actual entire movement, replicate a function to simply start moving? So the client handles the movement, but is told to do so by the server?

safe marsh
#

yea this is what I was thinking, as the client actor can check the servers state on spawn and then synchronize to it.

#

but the logic is a bit complicated to sync, that's why I thought there may be an automated way to do it

lone vapor
#

well i guess the "automated" way is simply clicking the replication box, but that comes with the implications you discovered. It gets tricky when you need to start doing more precise data sending to overcome these types of issues.

safe marsh
#

you can replicate variables, but for example, if I have a moveto function which is partially complete I can't replicate that

lone vapor
#

How long is the platform travelling before stopping? Does it then return to its original location?

safe marsh
#

it's more complicated, it moves between a series of spline points which are constantly changing

lone vapor
#

oooh...

#

Wonder if there's a way to split up the movement to fire for each spline point? So if a client connects mid-way through the movement, it only needs to way until it hits the next point before it gets the current position

#

Or surely there must be a way to just receive the latest position upon connect

safe marsh
#

it loops through the moveto function looking for the next spline point, so if I want to sync the movement I need to set the clients location to the servers on spawn, then update it's spline array, I get the feeling it will slightly be out of sync regardless

#

yes, need to request some variables from the server to the client to get current pos, and current moveto point, and figure out how to move it there, because if I replicate the var's it's gonna be wasted after the first frame

lone vapor
#

are you using a timeline for the movement?

safe marsh
#

I was thinking there would be some way to replicate the moveto state, variables etc for one frame, then switch it off so they were in sync but not constantly checking

#

no, just move component to node

#

I guess Ill try that method, thanks

#

if there's no other way to do it

fossil sentinel
#

Anyone ever have the issue where the blueprint will detect the client as the server?

twin juniper
#

this begin play gets called on every actor I have why ?

#

I mean I kill a player and when it respawns again it calls this on the killer as well

#

why does it call it on the other side as well

thin stratus
#

Because Replicated Actors obviously spawn on all Players.
And each of the instance calls BeginPlay.

real yacht
#

if my character spawn some loot when is killed, who is owner of that actor? (i didn't set owner explicit)

thin stratus
#

Since that should happen on the Server in the first place, I would say the Server

real yacht
#

yep, im spawning actor on server

#

okay, thnx

safe marsh
#

when a player logs into a dedicated server, is there some way to carry across a variable which was stored locally?

#

for example I have a map called entry where you set your name and select your class, then you click connect and it opens the map on the dedicated IP

#

how can I get the data from the client instance? OnPostLogin returns a new playercontroller with no data

real yacht
#

you have player state for every player

thin stratus
#

That also doesn't work on connection

#

Connection transfers no data by default.

#

You can use C++ with ClientTravel to pass some options via ?key=value

safe marsh
#

I want to persistent information across server travel

thin stratus
#

You said "Connect"

#

Server Travel is not connect

safe marsh
#

ya sorry, connect rather

#

entry is a disconnected local instance, when I press connect it opens the IP which is a different map

thin stratus
#

Yeah so you have 2 1/2 ways to do that:

  1. Is having a Backend and just passing the Server the unique ID of the Player so the Server can retrieve the data.
  2. Is saving the data on the Client on the GameInstance or SaveGame, after connecting performing a ClientRPC on, e.g. PlayerController. Then taking the data and sending it to the SErver via a ServerRPC.
safe marsh
#

so I need to use cpp? there is no object which can be referenced via BP which persists between a local session and connecting to a dedicated server?

#

ok, Ill try number 2

#

backend requires a seperate server to store the data right?

thin stratus
#

Yeah you don't have any object that is suddenly exesting on the server

#

Yes

#

It's the prefered way of course, but also the more challanging and expensive one

safe marsh
#

yea, I am just working on a personal project, and want to prototype it right now. so I dont wanna set up some DB etc

#

So once a client connects to a server, it retains it's gameinstance state? I thought gameinstance only existed on the server, and not a client once it was connected

thin stratus
#

GameInstance is an Object representing the Game itself

#

It has nothing to do with Gameplay or Multiplayer

#

It persists until you shutdown the game

#

Once per Player and only the local player knows about it

#

But yeah can of course "use" it to persist data

safe marsh
#

right

#

you mean GameStateBase, right?

thin stratus
#

No I mean GameInstance

grizzled stirrup
#

Is it normal for the GameMode to actually decrement the game timer, but decrement it directly on the GameState as done in ShooterGame? I had thought before that the GM should only handle things like initial spawns and general rules and start / stop events, but no second to second logic like time
ShooterGame has this logic on a timer in the GM:

    MyGameState->RemainingTime--;
        
    if (MyGameState->RemainingTime <= 0)
    {
        // End game
    }

Is it equally viable to do all the decrementing directly in the GameState, and if it hits 0 there, then call an OutOfTime function on the GameMode instead of essentially calling state functions in both the GameMode and GameState?

safe marsh
#

A custom gameinstance class can't be set in maps&modes/gamemode

#

so I guess I need to modify the base one to store the data

grizzled stirrup
#

You can set it in project settings @safe marsh

safe marsh
#

ohh my bad, it's in a seperate section šŸ˜‚

#

thanks guys, Ill try it out

grizzled stirrup
#

I actually was wondering too about that, I guess the base GI should hold structs for each specific game mode if data should persist between travelling?

#

Since there can only be 1 GI but could be many modes with different info that could potentially be passed across

thin stratus
#

The GI does not hold Gameplay data

grizzled stirrup
#

I suppose games like CallOfDuty just have one generic set of info that can be used across multiple modes (time / score limit etc.)

#

Well if you were to try and create a custom game for example

#

You'd have to store that custom game data in the GI between travel right?

thin stratus
#

No, GameModes get initialized via Options you can pass when calling OpenLevel as well as ServerTravel

#

These are supposed be read out

#

And thus also passed from GM to GM every level change

grizzled stirrup
#

Well if you have like 30 options is it not much more convenient to do it in a strut?

#

The options string in the node is really hard to read

#

I guess in cpp it would be much clearer

thin stratus
#

We have one struct that has a custom "Struct to String" method

grizzled stirrup
#

Oh that sounds v interesting

thin stratus
#

It basically constructs the options string

safe marsh
#

a server can't retrive a clients gameinstance/gamestate class, right? I need to request it via the clients playercontroller?

thin stratus
#

Stop saying GameState :P

#

GameState is something totally different from GameInstance

safe marsh
#

I mean, both of those classess

thin stratus
#

GameState is replicated and the Server can interact via Multicast RPC and Replicated Variables with the Client through it

#

GameInstance is not and can only be accessed by each client/game

safe marsh
#

ok

#

so I can get a server to send a request to a clients gamestate to return a var from it's gameinstance

thin stratus
#
FString UHLFunctionLibrary::ToOptionsString(const FHLHostOptions& Options)
{
    FString OptionsString = "";

    OptionsString += "?game=" + Options.GameModeShortCode;
    OptionsString += "?" + OPTION_MAXPLAYERS + "=" + FString::FromInt(Options.MaxPlayers);
    
    // Make sure we don't have negative or zero match times
    if (Options.MatchTime > 0)
    {
        OptionsString += "?" + OPTION_MATCHTIME + "=" + FString::FromInt(Options.MatchTime);
    }

    if (Options.bFillWithBots)
    {
        OptionsString += "?" + OPTION_BOTCOUNT;
        OptionsString += "?" + OPTION_BOTDIFFICULTY + "=" + FString::FromInt(Options.BotDifficultyLevel);
    }
    if (Options.bRequireFullLobby) OptionsString += "?" + OPTION_REQUIREFULL;
    if (Options.bRequireWarmup) OptionsString += "?" + OPTION_REQUIREWARMUP;
    if (Options.bRequireMinPlayersToStart) OptionsString += "?" + OPTION_MINPLAYERSTOSTART + "=" + FString::FromInt(Options.MinPlayersToStart);

    if (Options.bMapVoteEnabled) OptionsString += "?" + OPTION_MAPVOTE;

    if (Options.bOvertimeEnabled) OptionsString += "?" + OPTION_OVERTIME + "=" + FString::FromInt(Options.Overtime);

    if (Options.bTeamDamageEnabled) OptionsString += "?" + OPTION_TEAMDAMAGE;
    if (Options.bAutoBalanceTeamsEnabled) OptionsString += "?" + OPTION_AUTOBALANCE;
#
    if (Options.bRespawnByHandEnabled) OptionsString += "?" + OPTION_RESPAWNBYHAND;
    if (Options.bWaitBeforeRespawnEnabled) OptionsString += "?" + OPTION_RESPAWNWAITTIME + "=" + FString::FromInt(Options.RespawnWaitTime);
    if (Options.bForceRespawnEnabled) OptionsString += "?" + OPTION_FORCERESPAWNTIME + "=" + FString::FromInt(Options.ForceRespawnTime);

    if (Options.bForceWarmupEnabled) OptionsString += "?" + OPTION_FORCEWARMUP;

    if (Options.MapCycle.Num() > 0)
    {
        OptionsString += "?" + OPTION_MAPCYCLE + "=";
        for (int32 i = 0; i < Options.MapCycle.Num(); i++)
        {
            OptionsString += Options.MapCycle[i].ToString();
            if (i < Options.MapCycle.Num() - 1)
            {
                OptionsString += ",";
            }

        }
    }

    return OptionsString;
}
#

@grizzled stirrup

#

It is indeed cleaner in C++

grizzled stirrup
#

Thank you so much!!

#

This is amazing

#

Exactly what I was looking for

#

No need for loads of structs cluttering the GI

thin stratus
#

FHLHostOptions is obviously custom

grizzled stirrup
#

Yep, you'd create that in the base GM right?

thin stratus
#

We have a custom header file for structs

grizzled stirrup
#

Ah cool, cleaner than including the GM anywhere it's needed! thanks

thin stratus
#

OPTION_RESPAWNBYHAND etc. are #defines to avoid typos

grizzled stirrup
#

I assume if each player picks a skin in the lobby along with say an emote, in that case they'd store their chosen skin in the GI between travel and retrieve it when playing the match?

thin stratus
#

Yeah, although as mentioned before, a proper backend would be cleaner

#

However if it's not important if they cheat

#

And it's only a handful of customizations to pass

grizzled stirrup
#

cheating is fine in my game (not trying to prevent it)

thin stratus
#

then you can use ClientTravel

#

And create an options string for that too

#

?Skin=SomeName?Emote=SomeEmoteName

#

Options can be retrieved in AGameModeBase::Login

grizzled stirrup
#

Ah that's a great point too

thin stratus
#

(serverside)

grizzled stirrup
#

Damn you can really bypass the GI!

thin stratus
#

If you have either c++ or backend, yeah

#

The only thing our GI does is overall backend connection and data

#

So it connects to the backend, retrieves inventory, etc. of the player, as well as info about the game (store stuff) and that's it

grizzled stirrup
#

Really nice

#

Luckily my game can probably get away with no checks

#

But it sounds like you have a great solution there

#

Also can use this same options string to be able to change the gamemode but play on the same map right? To avoid having to make duplicate maps for different modes which I've seen people do

thin stratus
#

If you are on GameModeXY

#

And your match ends

#

And you want GameModeZ

#

Then you just pass a different GameMode for ?game=shortcode

#

Or rather you change it in the Struct

#

And convert it again to a string

grizzled stirrup
#

So easy! Thank you very much

#

That's amazing

#

I've been sleeping on these option strings

#

Seems extremely powerful and saves a lot of work

thin stratus
#

ShortCodes are setup in the Map&Modes Project settings

#

GameMode alias or whatever they are called

#

It's basically a Name to Class Map

grizzled stirrup
#

Ah great, will look into it now

#

Really appreciate the help!!

#

Last super quick question while you are here (and I'm reading your compendium), in general you should avoid timers in the GameMode for setting state like time right? That should be done in the GameState and any events that need to be fired called from there to the GM? Just a bit confused on the matter since ShooterGame does decrement the GS time directly via a timer like so:

MyGameState->RemainingTime--;
        
    if (MyGameState->RemainingTime <= 0)
    {
        // End game
    }

thin stratus
#

There is really no direct rule about it, the RemainingTime sits in the GameState for obvious replication reasons

#

Either GameMode or GameState have a DefaultTimer implementation by default

#

I think GameMode

#

And they utilize that to count down the GameState timer

grizzled stirrup
#

Ok so it's equally viable to have the GM just say to the GS "hey start the timer" and then the GS calling an EndEvent on the GM when it reaches 0?

thin stratus
#

Yeah we do the same more or less

#

We have two timers though one in the GS and one in the GM

grizzled stirrup
#

Any reason to have 2? Just curious and trying to separate state from init setup

thin stratus
#

GM handles stuff like automatically respawning players after they are dead for x seconds

grizzled stirrup
#

Ahh

thin stratus
#

Or checking the bot count

#

Or the bot teams

#

To AutoBalance

#

Or to add and remove bots if a player leaves

grizzled stirrup
#

Ok so it's not a time decrement timer on the GM but more a regular state check?

thin stratus
#

Yeah

grizzled stirrup
#

Gotcha, that's awesome

#

Thanks a lot

#

Back to your compendium for more learning now, appreciate you taking the time to help!

thin stratus
#

Just c hecked, i think GameState has a DefaultTImer function

#

That you just override

#

And for the GameMode you'd need to create one by hand

#

(1 second looping timer etc.)

grizzled stirrup
#

I'm not sure if GameStateBase has it (it might though)

#

But yeah either way will try and keep time in GS

thin stratus
#

It doesn't

grizzled stirrup
#

I'll just create my own since it's trivial

thin stratus
#

But MatchState based games should use the non-base ones

grizzled stirrup
#

True I might reparent in that case- all I have to do is change the .h to derive from GameMode and GameState instead of base right?

thin stratus
#

Base GS and GM are slimmed down versions for games that really don't need any match based stuff

#

Yeah and adjust the includes

grizzled stirrup
#

Cool will do that then and make use of the nice match flow options

#

Waiting to start etc.

thin stratus
#

You can extend that

#

Just make sure to follow their rules

grizzled stirrup
#

Was going to do my own simpler enum with just 3 options but yeah it's better to just derive from what they have

thin stratus
#
    // If a game needs to add additional states, you may need to override HasMatchStarted and HasMatchEnded to deal with the new states
    // Do not add any states before WaitingToStart or after WaitingPostMatch
grizzled stirrup
#

Again I'm confused on why it's a namespace and not an enum but I'm not sure if it's older code or it should be a namespace in that case

thin stratus
#

Mostly due to the ability to easily add in between given states

#

Also inheritance in enums isn't a thing or?

#

So you can't really extend that

grizzled stirrup
#

Ahh I see makes sense!

thin stratus
#
namespace MatchState
{
    extern HOVERLOOP_API const FName CountdownToEndWarmup;            // Counting down before ending warmup
    extern HOVERLOOP_API const FName PlayerIntro;                    // Showing a lineup of the players before starting
    extern HOVERLOOP_API const FName CountdownToBegin;                // Counting down before starting the actual match
    extern HOVERLOOP_API const FName MatchEnteringOvertime;            // Match is entering Overtime
    extern HOVERLOOP_API const FName MatchIsInOvertime;                // Match is in Overtime
    extern HOVERLOOP_API const FName MapVoteHappening;                // Match is in Vote Map State
    extern HOVERLOOP_API const FName WaitingTravel;                    // While the client waits for traveling
}

Example of what we do

grizzled stirrup
#

So that gets added in between the existing states? Or it's a complete override?

thin stratus
#

They aren't ordered

#

It just extends the namespace

#

The "ordering" happens by you not calling it wrong :D

grizzled stirrup
#

Ah I see šŸ˜„

thin stratus
#

You can set the MatchState to whatever you want whenever you want, which doesn't mean that's good

#

If you need more examples, check the UT source code

grizzled stirrup
#

Thanks will do! UT source code in general is tricky to understand as a fairly new beginner, but I'm sure an invaluable resource to learn from

safe marsh
#

well, I got it working but it took like 6 different RPC calls to pass the data around

grizzled stirrup
#

It's like Pro shooter game šŸ˜„

thin stratus
#

Yeah it is, but you'll find lots of cool stuff too

#

@safe marsh It needs 2

#

OnPostLogin -> ClientRPC -> GetGameInstance -> GetData -> ServerRPC(Data)

#

Both RPCs sit in the PlayerController

grizzled stirrup
#

Yeah the bot and lag compensation code is amazing at a glance, the only problem I have with it is all the hoops you have to jump through for example to fire a weapon, it makes it very hard to visualize what is happening unless you are very familiar with the code (at least for me)

safe marsh
#

right, Ill try that

thin stratus
#

Ah don't fiddle with that : @grizzled stirrup

#

The best is to code the weapon system yourself

#

And then maybe take some tricks from the other one

#

Like "How do they spawn effects?"

grizzled stirrup
#

Yeah I have coded a far simpler system and it's working great but I was very curious on how the pros do it

thin stratus
#

I usually use it to answer questions and not to copy from it

grizzled stirrup
#

Will definitely approach it like you said for other things

#

yeah I didn't copy from it either just wanted to understand how they do it as a professional level product

#

And it seemed quite complex and confusing

#

But I hear Fortnite's weapon code is even more complex as it uses the ability system haha

#

I'll stay to my simple stuff and only ref when looking to understand how Epic would solve a particular problem

safe marsh
#

so it seems to work, except the printname event isnt being called from the gamemode

#

it only gets called if I filter the gamemode with another RPC

#

not sure why, but that seems to work, I have to filter it twice?

thin stratus
#
  1. RPCs in the GameMode make no sense
#
  1. The rest should actually work
#

Despite the last image

ember needle
#

all, what is the best way to know that all players are ready with replicated states and gamestate after a seamless travel?

#

i’m asking because i’m getting an onrep called on playerstate for a repnotify variable, but its content are the default ones, not the ones of the CopyProperties functionality

ember needle
#

ok then... 😃 maybe a way to get an event when PlayersArray of a GameState is replicated?

twin juniper
#

@ember needle what Im currently doing in my game is simply having an if statement in the GameState tick function that checks if PlayerArray is equal to number of required players to start the game

#

Once it is, we know all the players have loaded in and life is good

#

Not sure if there is a better way, but it works well for me

#

(obviously the if statement only runs on the server)

ember needle
#

Yeah I was doing similar stuff (with a timer BTW) but conceptually... šŸ˜„ so I started creating my own player array based on PostLogin and Logout events and then replicating that... but there are so many corner cases where things can misalign.

twin juniper
#

Yes there is

#

I think I once read someone here say you're gonna have to like

#

override half of game mode

wary path
#

I'm having some problems setting up a steam enabled dedicated server (while everything works fine without steam). I use a session subclass to create a proper server session and followed all documentation I could find, but it still won't show up on clients. I've found some messages in the log which may be related (these are no custom calls by me):
[S_API FAIL] Tried to access Steam interface SteamNetworking005 before SteamAPI_Init succeeded.
[S_API FAIL] Tried to access Steam interface SteamUser020 before SteamAPI_Init succeeded.
[S_API FAIL] Tried to access Steam interface SteamFriends017 before SteamAPI_Init succeeded.
These messages have zero results on google.

#

I understand that SteamAPI_Init is only called on clients because it requires login, and there is no Steam login on the Linux dedicated server. Still, at the moment I have no clue how to fix this.

#

Does anyone have a hint?

#

This is the session setup:

void ABaseGameSession::RegisterServer()
{
    IOnlineSubsystem* OnlineSub = IOnlineSubsystem::Get();
    if (OnlineSub)
    {
        IOnlineSessionPtr SessionInt = Online::GetSessionInterface();
        if (SessionInt.IsValid())
        {
            FOnlineSessionSettings HostSettings;
            HostSettings.bAllowInvites = true;
            HostSettings.bUsesPresence = false;
            HostSettings.bAllowJoinInProgress = false;
            HostSettings.bAllowJoinViaPresence = true;
            HostSettings.bAllowJoinViaPresenceFriendsOnly = false;
            // TODO HostSettings.bAntiCheatProtected = true;
            HostSettings.bIsDedicated = true;
            HostSettings.bShouldAdvertise = true;
            HostSettings.NumPublicConnections = 6;
            HostSettings.NumPrivateConnections = 0;
            if (FParse::Param(FCommandLine::Get(), TEXT("forcelan")))
            {
                UE_LOG(LogOnlineGame, Log, TEXT("Registering server as a LAN server"));
                HostSettings.bIsLANMatch = true;
            }
            else
            {
                HostSettings.bIsLANMatch = false;
            }
            SessionInt->CreateSession(0, NAME_GameSession, HostSettings);
        }
    }
}
ember needle
#

I'm experiencing some weird interference and wondering if the addition of the switch may help... Basically I'm seeing the SlotID OnRep event being called with SlotID's default value, not the one it has before the travelling...

#

So I was thinking that this might be due to some "clash"between replication and copyproperties

sharp pagoda
#

Is it possible to create some ordering between two actor channels? I need a newly created replicated object to have it's replicator created on the client before the netguide resolve, otherwise I get an onrep with a nullptr. I tried manually flushing the channel representing the new object as well as a forcenetupdate, but it's still a packet race. Note that I get the expected behavior if I step through, allowing the packet to arrive in time.

fleet raven
#

there is no such thing by default

#

but if you figure something out pls post it here

sharp pagoda
#

yea will do, hoping someone had figured this out already

thin stratus
#

@ember needle It can't hurt, I don't think I#m actively checking though

#

But you can also just print

#

And check if Remote even prints :P

ember needle
#

remote prints? you mean if it’s called on clients?

#

however it prints the default value... that's what I don't get

wary path
#

Sad thing is, if I enable verbose logging, S_API FAIL no longer occurs. So I suppose this is an issue with Steam API 1.44 😦

timber tree
#

Hi,
I am STUCK ,
How to connect to a dedicated server with OnlinesubsystemNULL from a client with OnlinesubsystemSteam

bitter oriole
#

Can't

#

Well, not through OSS you can

#

You might be able to connect with "open <ip>" console command if the Steam OSS allows it

rotund sapphire
#

Stranger, but then you would connect without authentication. Which defeats the whole point isnt it?

bitter oriole
#

There's no point doing this

#

Doing your own matchmaking while using Steam is just weird

fleet raven
#

it's not at all weird when steam is not the only platform

timber tree
#

that mean there is no right way of doing it

rotund sapphire
#

The right way is to use the same online subsytem on both ends i guess.

timber tree
#

but then I cant use default port 7777 cause steam force the port to 27015

#

actually I tried with steam on both side but it created this port conflict, after which I removed steam from the server, now my client can connect without steam but not with steam

#

Well I guess I have to do some experiments with default port setting

granite peak
#

so for a whole week i was trying to fix what i thought was a networking bug with my wallrunning where clients would randomly unstick from walls.

turns out i never noticed the server player also did the same thing because apparently i have a large kidney bean can-size hole in my brain. i am thankful my wallrunning is shitty across all realms of existence

winged badger
#

first thing you test when you have a client bug is does it happen on server

#

second thing you test is what does server see when client is experiencing the bug

#

and if that doesn't provide any useful information, what does other client see when first client is experiencing the bug

#

most of movement related replication breakdowns happen on owning client only

granite peak
#

yeah i didn't test the wallrunning enough on the server, saw it work correctly whenever i tested it, but i only did a couple wallruns before seeing what would go wrong on the client šŸ˜‚

twin juniper
#

integers show up allright but i couldnt understand why not for the text

#

I tried string type as well and I am so confused

#

they are replicated

#

noone sees eachothers nick name variable

rotund sapphire
#

Send nickname to server with an RPC, so it gets distributed for everybody. But you should have the nickname on server already.

winged badger
#

best guess, its set only locally

#

so everyone sees their own name only

twin juniper
#

those variables are on the game state

#

kills and deaths works just fine

#

I created nickname right near them

#

and set it to replicate as well

#

ohh

#

wait

#

thanks for the help

#

I am so tired I forgot about that one lol

deft tree
sharp pagoda
#

So actor channels appear to be lazily created, what would be the proper way to force them to be created? Flushing the net connection? Maybe a force net update?

#

Neither do the trick

#

Calling RPCs seem to work, but that can't possibly be the expected way

winged badger
#

don't depend on them being created instantly

#

is the best way to go about it

sharp pagoda
#

I sadly need to though, I'm working on getting some order of dependency between channels

winged badger
#

NetPriority will help

sharp pagoda
#

From my post earlier: ```Is it possible to create some ordering between two actor channels? I need a newly created replicated object to have it's replicator created on the client before the netguide resolve, otherwise I get an onrep with a nullptr. I tried manually flushing the channel representing the new object as well as a forcenetupdate, but it's still a packet race. Note that I get the expected behavior if I step through, allowing the packet to arrive in time.

winged badger
#

but you're still fucked if the packet gets dropped

sharp pagoda
#

Yea right now I'm messing around with the SpawnAcked stuff in the actor channel, seeing if I can leverage that

winged badger
#

slightly inelegant

#

but if its a matter of life and death

#

TWeakObjectPtr from replicated object to its replicator, and OnRep that to get the dependancy reliable

#

one of those will fire correctly, always

sharp pagoda
#

Hm, nasty but it would work yea. I'm going to make one last effort and manually create these channels and see how disastrous it gets

winged badger
#

that is worse

#

šŸ˜„

sharp pagoda
#

Oh yea, I broke it

winged badger
#

i have not yet had a case where higher priority Actor ended up client side after the lower priroty one

#

if spawned in the same frame on server

#

but, i can't say i trust that 100%

sharp pagoda
#

Yea i'll probably do that for the time being, just need to leave myself a big "fix this shit later" note

winged badger
#

i increased by PS priority, and never got any of the ensures triggered

#

that i noticed

#

and that code is now few months old

#

(doing a fairly complicated object graph when spawning my player, so PC, AICon, PS, Pawn and Character are all involved there)

sharp pagoda
#

Yep seems reliable enough for now, thanks for the pointer @winged badger

winged badger
#

let me know if it breaks at any point, not sure if it can

#

and i would like to know is it possible

#

if they arrive in the same packet, it shouldn't be

sharp pagoda
#

Same packet no, the issue is separate packets

red musk
#

Hi everyone, I have a quick question:

I am updating healthbars in multiplayer via rep notify triggering a callback that the healthbar binds to, but on clients it is delayed by about ~1 sec (the projectile impacts them, delay, then healthbar updates)

#

Anyone know how to make it more responsive on the client?

fossil spoke
#

@red musk You would also have to "simulate" the Health changing on the Client

#

See how the Impact Effect hits immediately, that would be when you update the Health for the Client, the Server would then Replicate the correct value down to the Client incase the Client calculated it wrong.

#

The Client calculating it themselves is purely cosmetic.

red musk
#

So should I simply not hide this behind switch has authority?

fossil spoke
#

For this exact reason.

red musk
#

So both client and server update immediately

#

And the replicated player state ideally keeps them in sync?

thick shale
#

@red musk you could also try increasing your NetUpdateFrequency so it gets there a bit faster

fossil spoke
#

@thick shale Thats not ideal, your better off predicting it than just brute forcing the solution.

#

This is widely called "Client Side Prediction"

#

The Client predicts that what happened for them is going to be what the Server is going to report to them later.

#

It masks lag.

#

The lag still exists, but only if there needs to be a correction.

red musk
#

Thanks!

lime skiff
#

@red musk If you don't want to implement client side prediction yourself, Unreals GameplayAbilitySystem has a (simple) client side prediction which works well for many cases.

red musk
#

I'll check it out!

vivid seal
#

hey i have a kind of specific question for a mechanic i was working on, it's fairly similar to Mei's Ice Wall in Overwatch, essentially pulling a pillar out of the ground through scaling a flat cylinder mesh up to full height over time. I'm using vinterp with a timeline to set the scale, and it works fine. the problem is that in multiplayer, any player standing on top of the pillar has super jittery movement as it scales up, and will not appear to actually be able to stand on top of the pillar until they actually move again (for example, client 1 will fall through the pillar on client 2's screen any time he isn't moving, even though he is stationary atop the pillar on his own screen). I tried it by just spawning the pillar at full size under ground and then moving it up under the players, and that works just fine with no movement jitter, but obviously that creates huge issues anywhere you could potentially be under the pillar's spawn point.

Anyone have advice for smoother replication of actors on top of a scaling object, as right now i just let them get pushed up and then replication gets very weird

vivid seal
copper mango
#

@vivid seal are you saying it works fine in autonomous proxy but the simulated proxy jitters? Or both do

vivid seal
#

check the second gif, thats two clients on dedicated server and both jitter/fall through the mesh

#

the first gif is the mechanic made in an entirely different way, and i like the movement but there are other issues

copper mango
#

What if you replicate the scale/time velocity as well as the actual scale so that the client can predict the scale change in between replication updates?

#

Because the variable replication in the best case scenario is like you 5-10 updates per second from the server

#

If you replicate the velocity and the client also predicts the change it should look smoother

#

And the actual scale will still get corrected by the server

#

Alternatively you could try to fix the other issues with the movement appropriate if that doesn’t make it look better for you

vivid seal
#

i had something similar (server sent a multicast for clients to scale their own mesh and then another multicast to adjust after the scaling was done), is there a better way to do that?

copper mango
#

and the server was scaling it also at the same time?

vivid seal
#

yes, the only noticeable effect was the correction at the end stopping the movement, but its still jittery for a second

#

but i might have set it up incorrectly

copper mango
#

what issues do you have with the moving up instead dof scaling approach?

vivid seal
#

if i use it anywhere where something could be below me (in a building, over a cave, etc.) it would spawn on a lower level

#

it just feels like a weird solution

copper mango
#

Ah yeah that would be a problem

#

you could spawn multiple floor-height segments and just move them up at different rates like an accordion expanding, but that is janky

vivid seal
copper mango
#

Oh if I remember the CMC does a little bit of caching if the last FindFloor result so it doesn’t need to recalculate it every time

#

If you figured out the character was on the platform when it is growing, you might be able to change it to invalidate the last fine floor result maybe

sharp berry
#

Hi, Iam pretty new to multiplayer and have some general questions. So I do get the whole replication and server client relation thing, but what confused me was that in order to make unique calls you obviously need to have some unique object making that call, like a character controller. does that mean that my character class for example can't have for example an inventory component, or can it have one, but all references to self must be done via a controller reference?

pure night
#

Do you want this inventory being replicated or not?

#

Do the other clients needs to know about it or not?

twin juniper
#

Hey guys, total physics noob here. How do you replicate "weld" ? I have simulated actors, they replicate, but when I try to attach and weld it goes all wrong on the client. I can post a video if needed.

lucid vault
#

I need some advice on setting up a replicated chest that they player can open and loot. I have the inventory system set up, but what is the best way for the player to request the data from the chest? I know that I could probably replicate the items in the chest if the player is within a certain distance, but is there any way for the player to 'request' the items from the chest when he interacts with it?

rotund sapphire
#

If you can hook the chest to the inventory system then just show up the chest's inventory instead of players, with the items within. Pry saves you a lot of extra code doing this way.

#

You can also take example of how the inventory system is built and make a simplified version that is specially dealing with loot inventories that can be added to any actor. Packed all logic in a component you can pass in to any object

#

inugames, you can try attaching on client side as well it may be missing the rep of weld property by a bug perhaps.

#

Also, replication of physics is a long time issue with unreal and you may want to be cautious with this idea

twin juniper
#

@rotund sapphire Thanks, i will try now.

rotund sapphire
#

Replication can still be an issue with physics simulated objects. They usually show up more when you introduce network latency.

#

Stuttering and alike

twin juniper
#

I understand. Actually, it's just a "proof of concept" of sort, I don't plan to use it.
Btw, I found that the attached actor is detached when the parent has the physics turned on. I hold an actor with another one attached, when I release it I turn physics to the parent to on. Then on the server both stay attached and weld, but on the client they are detached.

#

blue is the parent and client is on the right

lucid vault
#

How do I only replicate an actor (ie. Chest) if the player is within a certain distance?

ember needle
#

there is a clear video series on replication principles on ue, hosted on youtube. i’d recommend to start from there. you’ll get a grasp on your question (network relevancy and onrep variables)

#

just the basics

lucid vault
#

@ember needle Thanks. If the actor (chest) replicates it's inventory based off of the distance the player is away from it, what is to stop cheaters from viewing the contents of any chest based upon the distance?

#

I think it would make more sense to somehow only allow access to the contents of the chest if the player interacts with it. But I can't figure out how to do that

timber tree
#

Hi, is it required to register dedicated server with steam, if I am using OnlinesubsystemSteam on the client side
client with steam cant connect to server without steam

grizzled stirrup
#

For round based games like CSGO what is a wise way to reset the game for the next round? Mainly thinking of AI controllers and characters. Should I iterate over all controllers and unpossess, then iterate over all spawned pawns and destroy before doing a fresh init / respawn on the next round?

#

Something like:

        for (FConstPawnIterator It = GetWorld()->GetPawnIterator(); It; ++It)
        {
           AMasterC*  CurrentC = Cast<AMasterC>(*It);
            if (CurrentC)
            {
                 CurrentC->Destroy();
            }
        }
sharp pagoda
#

@grizzled stirrup Yep, this is what we do

#
void ATDGameMode::RespawnAll()
{
    for (FConstControllerIterator Iter = GetWorld()->GetControllerIterator(); Iter; ++Iter)
    {
        Respawn(Iter->Get());
    }
}
void ATDGameMode::Respawn(AController* ControllerToRespawn, const AActor* const PlayerStart)
{
    UE_LOG(LogOnlineFramework, Verbose, TEXT("Respawning player: %s"), *ControllerToRespawn->GetFName().ToString());

    send client rpc, etc...

    // Destroy the pawn we're leaving if we have one. This won't destroy dead bodies since the controller detaches before respawning.
    auto* Pawn = ControllerToRespawn->GetPawn();
    if (Pawn)
    {
        UE_LOG(LogOnlineFramework, Verbose, TEXT("Destroyed pawn: %s while respawning player: %s"), *Pawn->GetFName().ToString(), *ControllerToRespawn->GetFName().ToString());

        Pawn->Destroy();
    }

    FActorSpawnParameters SpawnParameters;
    SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;

    auto* NewPlayerPawn = GetWorld()->SpawnActor<APawn>(DefaultPawnClass.Get(), PlayerStart ? PlayerStart->GetActorTransform() : ChoosePlayerStart_Implementation(ControllerToRespawn)->GetActorTransform(), SpawnParameters);
    if (NewPlayerPawn)
    {
        ControllerToRespawn->Possess(NewPlayerPawn);

        ... send client rpc, etc
    }
}
#

Then you can just RespawnAll() when you want to soft restart the match

grizzled stirrup
#

This is awesome, thanks a lot for the example!!

sharp pagoda
#

@timber tree You need to create a session in your game session's RegisterServer, a snippet from ours:

SessionSettings = MakeShareable(new FOnlineSessionSettings());
SessionSettings->NumPublicConnections = 10;
SessionSettings->NumPrivateConnections = 10;
SessionSettings->bAllowJoinInProgress = true;
SessionSettings->bIsLANMatch = false;
SessionSettings->bUsesPresence = false;
SessionSettings->bAllowJoinViaPresence = false;
SessionSettings->bIsDedicated = true;
SessionSettings->bShouldAdvertise = true;
SessionSettings->bAntiCheatProtected = true;
SessionSettings->Set(SETTING_MAPNAME, GetWorld()->GetMapName(), EOnlineDataAdvertisementType::ViaOnlineService);

OnCreateServerCompleteHandle = Sessions->AddOnCreateSessionCompleteDelegate_Handle(OnCreateServerCompleteDelegate);

if (Sessions->CreateSession(0, GameSessionName, *SessionSettings))
{
    UE_LOG(LogOnlineFramework, Log, TEXT("Successfully registered server."));
}

else
{
    UE_LOG(LogOnlineFramework, Error, TEXT("Failed to register server."));
}
timber tree
#

Let me try

meager spade
#

if i spawn an actor on server, that is replicated

#

then i add a static mesh to it at runtime

#

that will have to be multicast right? cause the mesh is being set on the server, but clients are seeing nothing

sharp pagoda
#

reliable component or on rep probably, I would imagine you want late joiners to see the mesh too

meager spade
#

there wont be late joiners

#

its a once you left, no rejoin

#

game

sharp pagoda
#

then a multicast does it

meager spade
#

yeah just its weird cause i did look a bit of how UT4 does dropped pickups, but it does no multicast and it adds the meshcomponent at runtime

#

(obvs trying to find ways to reduce network usage)

grizzled stirrup
#

@sharp pagoda In this line of your respawn send client rpc, etc... What happens in the client RPC?

sharp pagoda
#

A few things, including hud updates and whatnot

meager spade
#

kinda similar to what i did, so im just confused how there's works and mine doesnt

grizzled stirrup
#

Ah cool thanks!

hoary sandal
#

Hi guys I'm just getting started with multiplayer I manged to finish a small game jam project with one of the templates on the community https://forums.unrealengine.com/community/community-content-tools-and-tutorials/1533041-free-ue4-multiplayer-template-project-listen-server-steam and I was wondering if you guys could recommend some content that helped you learn multiplayer bp whether it's a tutorial/book/marketplace asset pack anything will be appreciated

copper mango
#

To be honest, I would not suggest trying to do multiplayer with just Blueprint. There’s a lot of MP functionality that is not exposed to Blueprint

#

I feel like making a more complex game that’s multiplayer and only in Blueprint will have you running into some walls at every turn

grizzled stirrup
#

For a CurrentRound int in a game that has rounds like CSGO, should that be maintained / updated in the GameState or GameMode?

#

I'm leaning towards the GameState, but there's also part of me that thinks each round is its own thing which would make the GameState only relevant for a round at a time

#

Will put it in the GameState actually just because it's accessible from the client!

#

For UI stuff

sharp pagoda
#

@grizzled stirrup Store in the game state, update it in the game mode through some sort of match tick function

#

Keep all of your match logic out of the gs