#multiplayer

1 messages ยท Page 676 of 1

slow pond
#

I'm not sure how you are doing it

#

I have a giant struct array that updates tons of units at once

#

every unit saves snapshots going back in time

#

the client can then diff against those snapshots

#

so

#

this is a good interpolation/exterpolation system:

#

for snapshots

#

however

#

the actual multiplayer code here

#

is terrible

#

and incredibly unoptimized

#

but the interpolation/exterpolation code

#

is excellent

#

and can be ripped out

#

replication is far more efficient than the rpcs and garbage serialization used in this though

#

it basically serializes in a way that disables unreal from using its built in bitpacking code

#

but you can rip out the snapshot code, which lets you have great control over smoothing and how far back to interpolate

prisma snow
#

yep, exactly. To be fair an RTS is not that hard at its core - a relatively simple 2D physics simulation, deterministic game logic... the rest (graphics rendering etc) is only client-side. The problem is getting there with Unreal

prisma snow
slow pond
#

that is probably not the way to go

#

also I wouldn't send rotation if you don't have to

#

and can infer it from what is happening

prisma snow
slow pond
#

can't you infer it from their state?

#

also

#

damage would be calculated on the server anyway

prisma snow
#

still, I don't have a way (yet) to send properties separately, I am sending the whole ACharacter

#

from what I understand, you have your units/actors/whatever, and you don't replicate them directly, but hold the properties that you want to replicate in an array, and sync both?

slow pond
#

i have an actor that I sync in the scene

#

and overseer

#

it has an array

#

I replicate that

#

then update the actors

#

I mean

#

to have 1000s of actors

#

you want to use a hism anyway

#

which means you don't have 1000+ actors

#

to make it run not like garbage

#

you can't have 1000s of skeletons in the scene

pseudo merlin
#

hi all, when a second player joins on a play in editor test, first player loses their ability to input controls

#

it seems like the input bindings are getting overwritten maybe?

dull chasm
#

Hello, I'm pretty new to unreal engine and trying to figure out some movement mechanics for a top-down game. Hopefully I'm not too far off in my current understanding of what I've done.

I'm currently using the CharacterMovementComponent, configured to orient towards movement, and uses accelerations for requested moves. This allows me to use a client side nav mesh while supporting multiplayer. I'm currently wondering if there is a better way to "turn in place". I've hacked together something using a path following component and an ability task to turn my player's character towards a cursor location when they want to use an ability, but I've done that by navigating to a location a nominal number of units ahead of the character, along a look at vector.

Is there a way I can turn the character without requiring that small amount of forward movement while using a CharacterMovementComponent configured to orient towards movement that is integrated with that system? Will I need to make my own set of RPC to explicitly LERP the character on the server side and have that replicate back?

elder sage
#

this is my current movement and the client appears incredibly jittery to the server. Should I have set it up differently or something?

slow pond
#

you don't replicate anything else

#

or sync anything else

#

then use rpcs to coordinate the other information

slow pond
#

Is there anyway to confirm a replication happened?

#

on the server

#

like to know a client replicated a change

kindred widget
#

RPC the server.

slow pond
#

ok that is slow af though

#

like internally unreal does confirm packets it received

#

for replication

#

is there any way to see that though?

prisma snow
#

Does HISM replace the need for individual actors entirely, or only their Static Meshes?

slow pond
#

hisms replace everything and are just a transform

prisma snow
slow pond
#

umm

#

the textures go into the shader

#

yes

#

and they are just maps of vertex displacements

prisma snow
#

@slow pond interesting, thanks for the idea, the concept was a bit new for me, although I have seen something similar for an RTS game

#

So you basically want to have very basic "units" which are just the minimum bunch of needed properties, in an array, and display them as HISM

slow pond
#

yes

crystal crag
#

@dull chasmDo you have any engine experience outside of unreal? Modding experience? Attempting to do a multiplayer game right out of the gate is going to be one heck of a headache if you answered no to all of those questions.

spring vortex
#

Anyone have any idea when doing a destroy actor event that the client doesn't have a reference to the actor? I know it sounds rudimentary for this particular case, the multicast shows the client as not having a valid reference to the actor while the server does. Doesn't matter who destroys it (client or server), the client never has a reference. Destroying actors how I normally do in MP simply doesn't work for this.

dark edge
spring vortex
#

Actor is set to not replicate

dark edge
#

Then you need to destroy it on all machines seperatly and a replicated reference will NOT work

#

They aren't the same actor on server and client side if it doesn't replciate

meager spade
#

^

#

only way you can handle this is having a unique ID on the door, and each client going through all door actors and destroying the correct one if its not replicated.

#

sending the door reference will not work.

spring vortex
#

Like I said, I know it seems rudimentary the normal method doesnt work. The client asks the server to do it, even if the server does it itself, it still remains on the client

meager spade
#

yes

#

cause its not replicated.

dark edge
#

replicate the door

spring vortex
#

Same result if I set it to replicated

meager spade
#

show your logic

spring vortex
#

It's not a door, for what it's worth

#

okay, this will a sec because it is a long chain of events

meager spade
#

oops ignore Door, i was working on doors, so got a bit brain farty ๐Ÿ˜›

spring vortex
meager spade
#

and where is this called from?

spring vortex
meager spade
#

the ISM's wont match

#

isms are not relplicated

spring vortex
#

I have no issues removing the ISM

#

If I break the logic the ISM is removed on both

meager spade
#

right lets step back a bit, cause you seem to be doing a lot of extra steps

spring vortex
#

Okay, let me do just a high level walk through, I very well may be doing extra steps

meager spade
#

why isn't ReplaceFoliage a run on server event?

#

directly/

spring vortex
#

I had it that way but the results I get are the same

meager spade
#

right so change it back

#

make it runon server and have it do the multicast

#

will clean up some nodes

spring vortex
#

Line trace hits ISM, replaces with BP, BP health is 0, spawns resources and it destroyed

#

okay will try

meager spade
#

right, so you need to do a couple of things

#

client hits ism -> Tells server i hit the ism, server checks the health and destroys if needed, else it replaces an ism?

spring vortex
#

It replaces on a single hit, but all that functions

#

If I disconnect here, the ISM is gone

#

Running replace foliage on server directly produces the same result

#

I'm assuming it has something to do with spawing the master resource actor

meager spade
#

is this what you are going for?

spring vortex
#

Pretty much, but the ISM isn't the issue

#

This guy, which is just a basic actor, will not be destroyed

meager spade
#

yes

#

because you spawned that locally

#

server and other client have no idea what that actor is

spring vortex
#

Okay, so yeah that was what I was figuring

meager spade
#

this here will spawn the actor locally for everyone

spring vortex
#

At one point I had it functioning, but the client had to destroy it twice

meager spade
#

this can not be addressed over the network

#

we handled all out ISMs with C++ and fast array serializer

#

was so much simpler that way

violet sentinel
#

replicated ism instance infos?

meager spade
#

issue is not the isms apparently

#

its the actor is spawned locally

#

isms work by index so technically you can not go wrong with them

#

@spring vortex i suggest a rethink of your design

#

you should spawn the ResourceManager on server only and set it replicated

spring vortex
#

Yeah, I'll need to. I did work towards a Resource Manager actor in the world but gave up in it

meager spade
#

or you spawn it locally and map it with a unique ID

#

and look up the local instance spawned, by the ID via a Map.

spring vortex
#

I guess my question would be, how is this different than spawning a pick up actor and having it be destroyed?

#

theorically I mean

meager spade
#

pickup actor is spawned on server

#

and replicated

#

and server destroys the pickup when its finished

spring vortex
#

so because this is called by a multicast is the issue?

meager spade
#

correct

spring vortex
#

ah okay

meager spade
#

everyone creates there own copy of that actor

spring vortex
#

hmm

violet sentinel
#

locally spawned actors often get out of hand, especially if you have join in progress new client will have no idea about them

meager spade
#

even if you replicate it, clients will then have 2 (locally created one and server replicated one)

spring vortex
#

so maybe I can call replace and respawn as two different events?

meager spade
#

you can consolidate that logic

#

into a few simple steps

#

what you have done is complex for what is happening

spring vortex
meager spade
#

@spring vortex here:

#

Client Hits ISM -> Server Replace Foliage gets called -> Replaces ISM -> Spawns new Actor. New Actor replicates and sets the mesh, etc

#

server also destroys the actor if its dead

#

also you should move those multicasts into the actor

#

they do not belong on the character bp

spring vortex
#

Appreciate the advice

meager spade
#

if you need help i don't mind jumping on screenshare with you and explaining, if you are still a bit confused ๐Ÿ™‚

spring vortex
#

Would you call these events from the ISM?

spring vortex
meager spade
#

its all good, just offering ๐Ÿ˜‰

spring vortex
#

I appreciate it, for real

violet sentinel
#

I would have an actor with ISM and replicated fast array member for state .
hits/updates happen on server
onrep of state array would update things on clients

spring vortex
#

As far are removing the ISMs and having them destroyed on a loaded game, not issues at all

meager spade
#

how does it work if someone new joins the game

spring vortex
#

So I worked toward onrep for a bit, but then I stopped as the actor would be gone, so my assumption was that the rep wouldn't fire

meager spade
#

or they enter relevancy of the actor?

#

Multicasts are good for one off things

#

but not for maintaining state

spring vortex
#

Host has to join first and it removes the actors before the player does. As far as I know, the client doesn't see them but we can test that in our next stream session

#

before the player joins I mean

meager spade
#

i like to use the Barrel analogy for Multicast vs OnRep. A barrel exploding would be a multicast, a barrel in dead state would be via a RepNotify.

#

you don't want to do explosion particles on a dead barrel for a new player, but you want to show the barrel being dead to the new player.

spring vortex
#

so onrep will still work even though the actor has been destroyed

meager spade
#

no

#

but changing isms on that actor

#

is a state change

spring vortex
#

okay, need to confirm that client cannot see server destroyed ISMs on load then for sure

#

will add that to the check list of the next MP test

#

As a side not, I will need to store the resource hit array some place else, as it stands now only the sever array is saved to remove foliage

#

right now it is just like minecraft, I haven't gotten to the point of saving and loading client data like inventory, health, equipment etc

#

conceptually I'll just store a struct array using the steam ID as the "primary key" for loading in client data

#

That is something that MUST be solved at some point though lol

spring vortex
#

Just some icing on the cake lol

#

I have it sorted, but it is funny getting excited for having it working then getting a merge conflict

lucid charm
#

hello, iโ€™m having an issue with replication

#

from what i can see in logs, all my actors are being properly replicated once, but after that one update, nothing more is updated on the clients

#

any ideas why this could be happening? thanks

chrome bay
#

Is the actor spawned or placed in the world? Is it dormant?

#

Have you set bNetTemporary = true;?

#

Are you using push model and if so, are you marking properties dirty when changing them?

#

And of course.. are those actors relevant?

#

That's the main culprit

lucid charm
#

what exactly is a push model?

bitter oriole
chrome bay
#

Also BP or C++? If BP, you don't need to worry about push

lucid charm
#

c++

bitter oriole
#

If you don't know push model you ain't using it

lucid charm
#

itโ€™s weird because i can see the actor channel being created for every actor that needs to be replicated and i can see some properties being updated but as soon as it replicates once, it will not replicate further for any actor and all i can see is acks in logs

bitter oriole
#

Show the code

lucid charm
#

not at pc currently

sacred flint
#

hi up please ๐Ÿ˜„

#

i really need help, i don't know why client can't interact with textbox (but can interact with all) but host can

kindred widget
#

There is no difference between server and client interaction with widgets until you program that in yourself. UI is all local, and should be treated as such in code. If your clients can't use that, check everything referencing it and look through the list of bindings in the widget. Something has to be doing checks or setting it up in a way based on net mode.

sacred flint
#

that computer with widget interaction

#

and so when I redid a blank widget, I only created a button and a textbox, I could only interact with the client side button

kindred widget
#

Ah. I don't remember how to set that up, but I remember an issue where you have to assign IDs to the widget interaction components if memory serves.

sacred flint
#

i do

#

in my bp character

#

host have 0

#

and my client have 1

#

widget interaction is on my bp character

sacred flint
#

why only my client can't interact with the textbox but can interact with all

lucid charm
#

itโ€™s not like it only stops replicating one actor, it stops replicating all of them

frank coral
#

hello, good evening, anyone know a recommended link for a good multiplayer fundamentals utorials video?

sacred flint
#

so how i can unlock this ?

bitter oriole
#

Start by having the entire UI stuff happen purely client side

#

If you have network issues in your UI, you are doing the UI wrong

frank coral
sacred flint
#

i do this

#

its simple

#

and i have created a simple widget test

#

all clients & host can interact (i mean buttons and all shits)

#

but client can't interact with all textbox

#

no sence

keen surge
#

stupid question, why my OnRep_Notify method executes on server?! it is simple method to spawn effect, if I using multicast unreliable nothing happened but if use reliable effect also spawn on client
Actor where everything executes is marked as Replicates

#

i thougt OnRep_Notify always executes on client

chrome bay
#

They do, unless it's Blueprint because BP is stupid

keen surge
#

problem was in Destroy Actor, that was happening before client call

#

so...my bad

keen surge
violet sentinel
#

what usually manages spawning of FX for weapon projectiles?

Player Pawn has Weapon Actor
Weapon Actor produce Projectiles (sadly they are spawned via netmulticast and very short-lived and super fast)
if projectile hits any actor that implements IDestructible it triggers TakeDamage and does damage processing

but what manages spawning on-hit effects when projectile hits something like landscape or anything else? Would it be responsibility of projectile or weapon or something else

#

i'm trying to un-vaal this system for several weeks that was made by some madman

chrome bay
#

Projectile would spawn it IMO

violet sentinel
#

as it become extremely overcomplicated

#

the problem is, projectile effects are based on damage and what it did to actor
but the projectiles are spawned locally which gives tons of headache and authority checks

#

every time projectile is shot - netmulticast, every time projectile hits something - netmulticast

chrome bay
#

eww ๐Ÿ˜„

violet sentinel
#

with several people with 600 rpm automatic weapons it destroys network

chrome bay
#

We actually process all damage locally anyway, just we only ever modify health on the Server. The engines built-in damage system (especially from Blueprint) doesn't make that easy though

#

Thankfully they're removing that crap in UE5

violet sentinel
#

not using UE TakeDamage system at all?

chrome bay
#

I only use it in one project and not by choice

#

It's horrid

violet sentinel
#

i can't get rid of it since professional blueprint coders actively use it

meager spade
#

i have a LocalFXManager actor in the world

#

which handles pooling/reusing of FX, etc

chrome bay
#

I think in this case it's more about spawning different FX based on damage.. but that's only calculated server side

#

Strange way to spawn FX though

#

Normally it's based on the surface you hit or something?

violet sentinel
#

there are tons of math and calculations on each hit counting entire actor, what bone was hit, what angle, what force etc then damage amount calculated and fx is chosen

meager spade
#

i hate client side damage

#

especially when you have modifiers and calculations

#

showing bad damage numbers, etc is worse than a delay

#

we predict the hit FX, but all damage is server side, with callbacks to the client who dealt damage with the damage data

chrome bay
#

yeah that's the only sane way IMO

meager spade
#

(in my personal project anyway)

#

in RS2, we have clients doing damage (all clients)

#

and lots of issues with bad damage numbers/health being out of sync etc

chrome bay
#

ah yeah we only modify health server-side, just can predict the calculations client side

#

(and no damage numbers for us)

violet sentinel
meager spade
#

i use GameplayCues

violet sentinel
#

oh

meager spade
#

and weapons for example, handle these and forward off to the LocalFXManager

#

@chrome bay in my project, a single weapon shot can do about 4-5 gameplay cues

#

per shot

#

each one of these is a Unreliable Multicast

#

i ended up doing custom batching based on the cue tag, as the data is the same for each cue, and just do one multicast, and unpack it and invoke the cues on the client

chrome bay
#

I never got that far into GAS/Cues.. are they like batched up unreliables with some data attached?

meager spade
#

they are not batched

chrome bay
#

ahh kk

meager spade
#

every cue is a single multicast rpc

chrome bay
#

righht

meager spade
#

that was 5 multicasts per weapon shot

#

i even ended up batching the ability activation

#

that was 3 RPC's per shot

#

now its 2 rpc's per shot, one for Ability Activation, Target Data, End Ability, and one for the Cues per shot

chrome bay
#

Yeah that's one thing I still need to do for our weps is batch the shot + hit together, but since everything is a projectile usually they aren't in the same frame anyways

meager spade
#

my weapon abilities are just simple trace, produce target data, send target data, end ability ๐Ÿ˜›

#

i did all the weapon firing (ROF, etc) inside the weapon class

#

or if its projectile weapon, it spawns projectile

#

Projectile then handles the stuff itself (i just send along a special GameplayEffectContainer that the projectile uses for Hit and Explode)

violet sentinel
#

does NetMulticast triggered on dedicated server too (just to confirm)

meager spade
#

hmm not actually sure tbh

#

ListenServer it does

#

so it probably does..

#

let me test real quick

violet sentinel
#

so atm weapon does netmulticast rpc that spawns local projectiles with no delay
the local projectiles play basic effects on hit
the projectile with owner that has authority applies damage and broadcasts damage effect hit netmulticast rpc for secondary effects

meager spade
#

yup

#

it does

violet sentinel
#

good

vernal hamlet
#

Iโ€™m lost at vr multiplayer, thereโ€™s literally Zero tutorial for unreal engine

2 VRs with 2 PCs

#

Can anyone help with this issue plz?

bitter oriole
#

Have one of he players run as listen server, the other can connect

#

open <ip> in console to start with, and then you can move on to sessions for your preferred social platform

#

VR doesn't change anything here, any tutorial on multiplayer should cover it - and you should probably work as much as possible with one PC without the VR support

#

Key to multiplayer work is to set yourself up with a nice environment to work in multiplayer and two different machines, while very good for real-world testing, ain't it

vernal hamlet
#

Okay so please bear with me, spawned 2 player starts

#

And then

#

I changed these settings here to this

bitter oriole
#

You can use screenshots directly - print screen key, then ctrl + v here

#

But okay

vernal hamlet
#

Real sorry about that

vernal hamlet
# vernal hamlet

So i made listen server, now after this step should i package it and open it on another pc too so i can open console and connect ip and it can join ?

bitter oriole
#

That's one way but you'd only do that when you're confident the multiplayer code works

#

Use the editor multiplayer to prototype outside VR

obsidian cargo
vernal hamlet
#

i tried this method, but seems like something is missing, and the widgets don't appear on screen, looks like it only works for fps, not sure how to correct it to be vr

obsidian cargo
#

I'm doing a game that will ultimately be VR, but I'm validating my replication through some non VR characters first because the iteration time is so much more rapid

vernal hamlet
#

Does anyone have Bp code that i can apply to mine ? all i want is to simply join with another vr PC ( as i do have 2 VRs and 2 PCs)

dark edge
vernal hamlet
obsidian cargo
#

IIRC the VR Expansion Plugin example has some UI to do quick LAN testing, but I've not used it myself

vernal hamlet
vernal hamlet
dark edge
vernal hamlet
#

Iโ€™m sorry for being vague but i seriously need to make this work

#

Iโ€™ve worked with unreal for 8 months but nothing multiplayer

quiet fjord
#

Guys I have a problem I am doing a game mode of respawn of players with their statistics that I have saved in load and when I eliminate the server player when respawn again I do not get their statistics and it is because I am eliminating the server client user there Some method so that the other players take their load

dark edge
obsidian cargo
nimble parcelBOT
#

:triangular_flag_on_post: Adrio#7720 received strike 1. As a result, they were muted for 10 minutes.

twin juniper
#

Hi guys, we are trying to get 2 occulus quests to work together, we have 2 pcs at our workplace. We are struggling for a week to make multiplayer work. ive seen ppl ask here about it,

#

we have the same issue

winter coyote
#

Hello I'm a ue4 developer and I want to create a online game like fortnite and I've created characters and maps please help me and tell me how can I will programing my game's online part?Please provide a training package or a YouTube channel for this๐Ÿ™๐Ÿ™๐Ÿ™

keen thorn
#

@dark edge Hi, since you're also working on multiplayer vehicle physics. is it possible to share your physics correction settings?

crystal crag
#

Also, all you said is that you are a ue4 developer - no mention was made of how many years of experience with C++ or any other language you have.

#

There are no "make a complete fortnite game from A-Z" courses out there. Best you can do is check out places like Udemy's or Tom Looman's multiplayer courses or browse the example projects UE puts out there (such as shooter game)

#

eXi's docs are really good too

thin stratus
#

Simply put if you need a tutorial for making a game like this you should forget about it

#

You lack experience

lost inlet
#

that was pretty clear lol

thin stratus
#

๐Ÿ˜ฉ

lost inlet
#

like when people think they're going to make an MMO as their first project

thin stratus
#

I would advice everyone here to not engage users like these too much,specially if they show no understanding. It's an ever repeating thing and it costs time and energy

#

Should probably make a website for this with multiple urls pointing to it

lost inlet
#

and it's just a single page saying "Don't"

pure vigil
#

It is unfortunate too because I definitely have no desire to quash people's desire to develop games by being dismissive about it but they need some kinda reality check

thin stratus
#

Yeah I mean you can discuss with them if you want. And maybe the understand and you can guide them to a smaller scope, which would be wonderful

crystal crag
#

The problem with ignoring them completely is that they won't take that as a no. They will continue to waste time trying to complete an unattainable task.

thin stratus
#

Just make sure you back out if it looks like they don't get it

pure vigil
#

only so many times you can have the same conversation though ๐Ÿคทโ€โ™‚๏ธ

crystal crag
#

Yeah, that part I agree with

thin stratus
lost inlet
#

well this channel has a bunch of useful pinned messages for networking topics in UE4

pure vigil
#

I definitely sympathize with them a little bit because I remember back when I was ~13 thinking I'd get into game dev and make an mmo

thin stratus
#

A shitty formatted compendium that should really be redone to match current state. Maybe with the release auf UE4 and new images

pure vigil
#

20 years later now I DEFINITELY don't want to make an MMO ๐Ÿ˜†

thin stratus
#

I sympathize with them too, tried to make some multiplayer game in unity a couple of years ago and started in UE4 with trying to make some story driven multiplayer survival while studying.
Internally we are now down to a Singleplayer game with limited scope :D

pure vigil
#

Yeaaah.. I started with multiplayer in UE4 and hit the same walls so many people do. But instead of scaling down to singleplayer I slammed my head against the wall for 5 years until it all made sense. didn't necessarily take that long but ..

#

I don't know. I have a hard time with singplayer. I know I would have actually completed stuff by now if I did singleplayer

#

but .. i cant

lost inlet
#

the thing with SP is mostly things "just work"

thin stratus
#

After having worked on the Ascent for 2 years I really don't want multiplayer anymore atm haha

lost inlet
#

different story for online MP

crystal crag
#

I'm in the same boat. I'm a single dev making a game in my off time (like now, during my 2 week vacation, I'm making my game). I could have had the game already into the pure content creation phase at this point if I didn't try to make it MP. But SP is boring for me. I want to play with my kids and wife

#

so if it takes another year and a half, so be it

pure vigil
#

Hopefully you don't burn out before you finish ๐Ÿ˜ฌ that's been the story of my last .. 10 projects

crystal crag
#

Here's to hoping. I've been able to stay on the same one for over a year now.

thin stratus
#

We actually stayed in the same world as the previous project which is on halt due to scope too, so we can reuse things in the future

#

Work smart!

#

But yeah, to get back to the original thingy, guide them but don't burn out on those peeps

pure vigil
#

I had to stop answering questions on the UE4 forums because so many questions were basically "how do I make a game"

thin stratus
#

My Ill butt will now try to sleep. Have a great day/eve and take a break once in awhile!

pure vigil
#

g'night! but .. no ๐Ÿ™‚

lost inlet
#

yeah the r/unrealengine subreddit is pretty bad too, even the memes

#

the memes are like "yeah, I can tell you don't do this professionally"

pure vigil
#

some of the memes give me a chuckle. specifically ones about compiling shaders

odd idol
#

Does anyone happen to know if there is some indication client side when re-relevancy occurs for an actor..? Seems a bit meh to check the life time, but I can't really see anything in the net driver. thinkRoll

harsh lintel
#

would a dedicated server that is struggling network-wise (e.g. way too many rpcs/players) cause fps drops on clients?

pure vigil
#

I wouldn't think so ..... but I may not be fully comprehending the impact that would have. I would think clientside you would see a lot of rubberbanding.

#

But not necessarily FPS drop ..

#

Actually really interested to hear what others would say about that

odd idol
#

Theoretically I suppose you could affect FPS from what you do on the server. Say you send a lot of data that then has to be processed in the actor channels at frame start. But realistically, I have a hard time seeing that ever being a concern

#

And if that is a concern, you probably have a larger design problem on your hands :3

#

You can always see what is going on by using insights though, so you should start there.

#

@harsh lintel

exotic spindle
#

@odd idol what do you mean with re-relevancy?

#

if thats some proper engine term, I certainly dont know about it ๐Ÿ˜„

odd idol
#

NetRelevancy is an engine feature that lets you stop replication for designated actors either for all or only some channels

#

Re-relevancy is when an actor that has become irrelevant for some client (and was thereby destroyed) becomes relevant again (and is thus spawned on that client again)

exotic spindle
#

ah, gotcha. All our actors are AlwaysRelevant so I wouldnt know about this

odd idol
#

As far as I can see there is no good way to determine if a spawn/beginplay was due to rerelevancy or not though SadTracking1

exotic spindle
#

But seeing that the actors are non existant when not relevant, BeginPlay would jhave been my guess

#

I mean you could manually denote the intentional spawning, no?

odd idol
#

Yeah, but a BeginPlay could be because a spawn was issued, or it could be because of rerelevancy :<

exotic spindle
#

with BeginSpawningActor -> Set bool that its not through net relevancy -> Finish Spawning Actor

#

BeginPlay is only called after FinishSpawningActor

#

UGameplayStatics I think it is

odd idol
#

I believe that chain occurs for both spawn paths, so I don't think it would make a difference ๐Ÿค”

#

I'm currently trying to debug if there are any callstack differences, but don't really see anything so far..

exotic spindle
#

no, you spawn that said actor manually, at runtime, right?

#

Using SpawnActor I suppose

odd idol
#

The engine does, yes ๐Ÿ™‚

exotic spindle
#

technically your CPU does ๐Ÿ˜›

odd idol
#

Well, by engine I mean it is the net driver, not project code that processes the spawn

exotic spindle
#

so just replace SpawnActor with UGameplayStatics::BeginSpawningActor, then set the boolean, then call FinishSpawningActor

#

Ohh wait

#

so your issue is not to differentiate the spawning of that actor through a.) the unrelated spawning locally due to some gameplay actions and b.) the actor being received through net relevancy

#

but instead a.) being spawned through net relevancy and b.) being re-spawned through net relevancy?

#

Otherwise I don't get the issue, then you could just use the approach I mentioned

odd idol
#

Well, it's all kind of related, but my specific issue is to determine whether an actor receiving fast-array replicator data was spawned due to re-relevancy or not ๐Ÿ™‚

exotic spindle
#

So what are the different cases that said actor can be spawned through?

#

Just want to make sure we're not talking past each other

odd idol
#

Hmm, I'm probably missing a few, but the ones I can think of right now:

  • User-code
  • Load from package
  • Re-relevancy
  • Netdriver/replicated spawn
#

hmm

exotic spindle
#

Right. Those all sound pretty easily distinguishable for me, given the approach I mentioned

odd idol
#

I might be misunderstanding then somehow

exotic spindle
#

Because you're issue is differentiating between User-Code and Re-Relevancy, right?

#

primarily for now. Then we could talk about Load from Package

odd idol
#

No, in most cases it would be between a netdriver spawn (spawned on server, then replicated to client) and re-relevancy

exotic spindle
#

ah, yeah you added that afterwards, or I am blind

odd idol
#

No, I was struggling to find the term xD

exotic spindle
#

yeah given that it's literally not connected at all anymore to any potential previous instance of that actor, I am not really sure

odd idol
#

Yeah, it's a bit weird though, since this seems to me a fairly common thing ThinkingTag

exotic spindle
#

is it? Whats your use-case, roughly?

#

well, yeah now that I think about it, I could see why you'd like to know

odd idol
#

If I get signals after re-relevancy, I don't want to replay certain effects for example

#

Let's say something blows up when you first shoot something, when it becomes re-relevant I don't want it to blow up again ๐Ÿ™‚

#

Normally you would solve something like that with RPCs or cues

harsh lintel
odd idol
#

But there are circumstances with our project ๐Ÿ™‚

exotic spindle
#

not sure if thats just a poor example, but the "explode" would be a state or RPC in the first place, no?
you'd have some sort of state boolean or enum "am I exploded", which you'd check on the client

#

Like, there's no data being lost, right? the initial replication has to have finished, before BeginPlay is triggered, so all the info regarding whether anything would have to explode again should be available on the client

odd idol
exotic spindle
#

if you want we can jump on a call, may be easier

odd idol
#

But my workaround with checking actor lifetime works

exotic spindle
#

Yeah but I am curious, I don't like not understanding the issue ๐Ÿ˜„

odd idol
#

Would just be nice to be able to get relevancy status from the net driver... might make a PR if this annoys me enough ๐Ÿ™‚

exotic spindle
#

It may be something very specific to your project, but the fact that you said it's something fairly common, it makes me think whether you may be tackling something a way its not really intended to be tackled in

dark edge
#

It's a trade-off between smoothness and accuracy

odd idol
#

But you know, secret sauce and all that kannaCrepeNom

exotic spindle
#

Still on Embark? ๐Ÿ˜›

odd idol
#

Yeop :3

exotic spindle
#

Anyway. Don't know of a solution for what you're specifically looking for. I too hate it when I google some question, finally find some obscure UnrealAnswers post and people are just like "weeell you know this isnt best practice anymore since 4.16, do this and that instead"

keen thorn
#

i just wanted to know if u have found a sweet spot that I could try myself'

odd idol
dense ocean
#

I'm setting all players in my session to a new location using SetActorLocation called by an RPC that is Run On Server, from the gamemode. It works for the player that is hosting the server, but all of the connected clients do not see that they are at the new location until they jump. Any ideas?

kindred widget
#

There may be another way around it, I never cared to look. But I know the reason for it was CMC stuff. If you do a character RPC and set the actor's location locally I recall that worked pretty well.

dense ocean
#

thanks!

#

still trying to mess with it

kindred widget
#

There may be a way to mark the CMC dirty too. Would definitely be cleaner code that way.

rancid flame
#

I'm trying to understand some of Unreal's multiplayer terminology and how MatchState is expected to flow. Maybe someone can help.
It seems that as soon as someone joins a world, the match is automatically started? I thought there would be a period of time while players are setting up before a match actually starts?
Should I be getting my players to join as spectators first?

dark edge
rancid flame
#

@dark edge GameMode right now

odd idol
#

If someone happens to run into my problem:
The way I solved it was to record the creation time of the net channel. You can then compare relevancy time with the creation time and pass that into PostNetInit() to let user code react to it.
This works since channels are not destroyed during non-relevancy.

LoveSilver

dark edge
rancid flame
#

Unfortunately bool ReadyToStartMatch isn't virtual, it's just a BlueprintNativeEvent ๐Ÿ˜ฆ

chrome bay
#

ReadyToStartMatch_Implementation is virtual

slim matrix
#

dose is server also return true if the server is a dedicated server

meager spade
#

ofc..

#

its a dedicated server

twin juniper
#

Hello I want to ask some things about multiplayer. I can understand that if you want to make a pvp game needs a server behind. But what about a coop game

#

One client can be the host

#

So he can be the server?

#

How this work?

#

Do I need to host a server for this?

#

Can it run p2p?

obsidian cargo
obsidian cargo
twin juniper
#

Yep my first time in networking, I would love to learn about how multiplayer games work. I know about how dedicated servers works

#

One question

#

If someone become listen server and server check almost everything

#

This is heavy right?

obsidian cargo
obsidian cargo
#

Backbone for network multiplayer is replication and RPC. That video series gives a really good introduction to the concepts.

twin juniper
#

Okay thanks I will check them

fiery badge
#

Hey!
I want to use AWS GameLift services for my game,
I have created a free account in AWS,
now I want to upload my game server to the fleet,
I want to know if I have to close or disable the server or services when I am not using it,
If YES then how?
I have linked my credit card with the account and I am just testing so I don't want to spend money on a server or services that I am not using since I am testing the free services will be enough for me.

kindred widget
#

@slim matrix IsServer will literally return true for everything that is not specifically a client. The check is GetNetMode() < NM_Client. Which the NM_Client is the last entry in that enum. So DedicatedServer, ListenServer, and even Singleplayer's Standalone setting will all return true for that function.

dark edge
#

Of course the more clients the heavier but it depends.

bitter oriole
#

You'd only use listen servers for small cooperative games anyway

#

So it doesn't really matter much

#

The bandwidth will be much more limiting than performance

twin juniper
#

Okay

#

Thanks a lot

winged badger
#

not quite

#

performance is a problem on listen servers much more then bandwidth

#

as you need to run client + server

#

can vary with the game, ofc

#

but we have very low bandwith use with 8 player coop on listen servers

#

while we are still struggling to optimize

bitter oriole
#

Yeah it'll depend on the game for sure, but I wouldn't expect a 8 player listen server to be way more expensive than a client

dark edge
#

It'll all depend on what you're doing really. It'll cost somewhere between O and O^NumClients depending on how good your architecture is.

meager spade
#

@bitter oriole you are mistaken tho

#

NetTick is around 4-8ms

#

with a 8 player listen server on a moderate size game

#

and most of that is replicating actors

#

even though we went to lengths to reduce that count

#

(and we have about 200 actors only that are replicating), its still expensive

nova wasp
#

is NetTick mainthreaded?

meager spade
#

yes

dark edge
#

BulletManager vs 1 actor per bullet for example

meager spade
#

it scales with actors and rep property count

#

as there is also a cost on property compare

#

also net update frequency and priority

#

all of them combined tbh

dark edge
#

So something with non replicated data but replicated events (replicating "Bullet fired at position x and velocity Y" rather than the bullet state) might be a lot lighter I think. That'd be good for something with a lot of projectiles in flight at any given time.

chrome bay
#

Just have to compare to how Epic used it in the past. Think about Gears/UT etc. Gears was 10 players max and Gears 1 + 2 were all listen servers

#

UT I think scaled up to 16 players max maybe?

meager spade
#

RPC's also have a cost

bitter oriole
meager spade
#

yeah its suprising

#

we hit around 12ms before we did some major optimization

dark edge
#

What did you find that really stood out as spendy?

meager spade
#

sheer amount of replicated actors

#

Dormancy is your friend

#

make sure things that are never moved are domant

#

and just flush dormancy if they need to update something (if they update very very infreq)

#

domancy flushing does force all props to replicate

#

but its better than replicating it all the time if its state changes like 1 time a minute or w/e

#

or maybe never changes at all during the game

ancient badge
#

Hi, when i spawn an actor and assign him a integer based on whom spawend him. (Player 1, Player 2).

Does the other Player automatically know that integer because im replicating that actor or would in need that integer a repnotify?

meager spade
#

property just need to be replicated

#

RepNotify is if they need to respond to that property changing

ancient badge
#

Well the other player uses this integer to assign it a color. And since the integer changes from 0 to something it would be a repnotify? Because if you create an integer variable on an actor it is normally 0.

meager spade
#

yes it will need to be RepNotify

#

and handle the colours in inside the OnRep function

ancient badge
#

Ok thank you

pseudo merlin
#

Hi all, I'm looking to spawn a replicated actor with some preconfigured properties (different than defaults). If I use deferred spawn on server, setup my properties, then finish spawn, would that actor spawn on clients with synced properties? Or would there be a delay between spawning and getting properties? Thanks.

meager spade
#

they would be synched

#

even if you didn't defer spawn it

#

if you set properties the same frame, replication happens a few frames later

pseudo merlin
#

Would it be safe to call functions on client at beginplay that are based in those props I want ready at spawn?

#

Or should I use onrep?

meager spade
#

props are set before BeginPlay

#

but the onreps will also fire if you have them

pseudo merlin
#

Thanks ๐Ÿ‘

prisma snow
#

Hi! I am sending a Struct (UStruct) as param for a multicast RPC, somehow the Server gets the struct correctly but the other clients don't (its values are initialized as default). I am not very sure how Structs work in terms of reference/value and how are they passed around

pseudo merlin
#

are the props marked w/ UPROPERTY()?

prisma snow
pseudo merlin
#

i think ue4 only serializes things marked w/ uprop

#

so try that

prisma snow
#

nice thanks

pseudo merlin
#

ah not sure

prisma snow
#

when using the debugger, I get this:

#

error = read memory from 0x4fa7f81843 failed (0 of 1 bytes read)

#

the struct itself is just a param from the function, it is not a class member of any sort (it is just a temporary data container)

obsidian cargo
chrome bay
#

You override the _Implementation if you have to override anything at all

#

Generally not a good design approach though

prisma snow
obsidian cargo
prisma snow
#

yep

obsidian cargo
#

Hmmm... I'm out of ideas.

prisma snow
#

yeah me too ๐Ÿ˜„

#

it is not the first time I have issues with structs, but it is the first time I encounter them in a RPC setting

obsidian cargo
#

I've seen unit'd structs go across a rep, but it was a different scenario.

prisma snow
#

The only thing I can think of

chrome bay
#

Paste the USTRUCT declaration

pseudo merlin
#

also is struct huge?

prisma snow
#

no, it is small

pseudo merlin
#

by huge i mean over 64kb

#

ah ok

prisma snow
#

mmm

#

it contains a couple vectors, two object references, and some scalars

chrome bay
#

yeah but paste, need to see code to see any potential error

obsidian cargo
pseudo merlin
#

lol yes

obsidian cargo
#

Is it a voxel world?

pseudo merlin
#

lol yes

obsidian cargo
#

HAHAHA!

#

GL!

#

I was dealing with that earlier

#

PITA

prisma snow
#
USTRUCT()
struct FOrder
{
    GENERATED_USTRUCT_BODY()

    UPROPERTY()
    EOrderType order_type = EOrderType::ORDER_None;

    UPROPERTY()
    FVector location = FVector(0.0f);

    UPROPERTY()
    AEntityHandle* target_handle = nullptr;

    UPROPERTY()
    APlayerController* controller_instigator = nullptr;

    UPROPERTY()
    EOrderQueueType order_queue_type = EOrderQueueType::Perform_Now;

    UPROPERTY()
    bool ignore_buildings = false;

    UPROPERTY()
    bool auto_rotate = true;

    UPROPERTY()
    FRotator rotation = FRotator(0.0f);
};
obsidian cargo
#

I can help you over DM if you like

pseudo merlin
#

thanks! I can dm when I get started with it, just thinking ahead for now

chrome bay
#

Yeah so that looks fine

#

And the RPC call?

obsidian cargo
prisma snow
#
    UFUNCTION(NetMulticast, Reliable, WithValidation)
        void NetCastPerformNextOrder(FOrder order);
chrome bay
#

It should be const ref

#

Also WithValidation has no effect on NetMulticast IIRC

#

It's only for Server RPC's

prisma snow
#

ahhhh interesting, thanks

#

let me try then ๐Ÿ™‚

chrome bay
#

compiler should output a warning about that last I checked

#

RE const ref

#

Bear in mind though, APlayerController* will only be non-null on the client who owns that controller, and if AEntityHandle hasn't replicated yet that will also resolve to null

prisma snow
#

Can you recommend any read that talks about structs? I don't quite understand them in UE4, in C++ they are mostly equivalent to classes but not here, if I am not mistaken

chrome bay
#

USTRUCT() at least is very different in that it's just for data, generally

prisma snow
#

yeah

chrome bay
#

They can have functions but not UFUNCTION()

prisma snow
#

and I cannot have pointers to UStructs

chrome bay
#

You can but not reflected ones (i.e. UPROPERTY)

prisma snow
#

mmm I see

#

so I gues it is trial and error ๐Ÿ˜„

chrome bay
#

Any pointer to a struct that you keep, reflection/GC is unaware of

prisma snow
#

makes sense

chrome bay
#

There's ways around it but it requires a lot of supporting code usually

#

and is generally not so useful

prisma snow
#

yep, I usually use UObjects when UStruct gives me problems

#

I dont know if it is a good idea but usually worked

rancid flame
#

I'm still trying to get my head around what Unreal wants me to do regarding HasMatchStarted. It seems to be used both in GameModeBase and GameMode. Their concept of "match" is just people being in the server? It seems that MatchStarted is called as soon as people join?

Can I define it to be when people have joined and chosen characters and readied up, or should I just ignore it and make my own concept like HasRoundStarted?

meager spade
#

yes

#

we overrode a ton of the GameMode/GameState

rancid flame
meager spade
#

we use GameState/GameMode

#

and just overrode lots of stuff

crimson valve
#

What does it mean when the SharedSeriaialization RPC Miss and SharedSeriaialization Property Miss are spiking?

jolly siren
#

If I spawn a non replicated actor clientside and serverside independently is there a way to tell the server that they are the same actor? As in associate the clientside and serverside representations? Is that driven via name or netguid?

meager spade
#

heh

#

we fake it

#

netname stable should cause them to link

crimson valve
#

is 6k bytes reasonable net traffic?

#

The connection keeps getting flagged as saturated--

meager spade
#
bool UObject::IsNameStableForNetworking() const
{
    return HasAnyFlags(RF_WasLoaded | RF_DefaultSubObject) || IsNative() || IsDefaultSubobject();
}``` this is what disabled IsNameStableForNetworking @jolly siren
#

did you increase the defaults for allowed sizes

#

iirc the default is super low

crimson valve
meager spade
#

we just return true on our fake ones

crimson valve
meager spade
#

listen server?

crimson valve
#

Yes

meager spade
#

yeah you need to clamp it

#

if someone is running like 200fps

#

boom

#

saturates the connection

crimson valve
#

clamp = MaxNetTickRate ?

meager spade
#

bClampListenServerTickRate=true

#

in your netdriver config secion

crimson valve
#

This is a VR game with just two players, so I was trying to keep the net tick rate relatively high. What should I clamp it to?

meager spade
#

we set MaxNetRate and NetServerMaxTickRate to 60

#

60 is fine

jolly siren
#

Thanks Kaos

meager spade
#

we run that on 8 player coop

crimson valve
#

Thanks for the help

#

@meager spade I've got voice data going through an RPC. The RPCs should respect this tickrate limit too, right?

#

And I think that bClampListenServerTickRate tip was the key. The huge lag is gone now.

meager spade
#

yeah and cool ๐Ÿ™‚

#

downside to listen servers :/

crimson valve
#

It's odd to me that that isn't enabled by default

#

It's caused me like a week of pain

deep shore
#

Hello, hopefully somebody can offer some advice. When a client dies in my game, their mesh is supposed to convert to a backpack after simulating physics for a few seconds. switching the mesh to a different object seemed to be the easiest way to stop expensive physics simulations without it looking too strange. The issue is that clients seem to often miss this replicated event altogether, and see a stationary character mesh standing in place after they respawn or enter an area where somebody else died. Should I create a new event and set it to reliable? or is there something else I may be missing?

twin juniper
#

I'm trying to send a NetMulticast RPC called from the server, however in the same function I need to do SetReplicates(false).

When I try and send off the NetMulticast RPC, then follow the next line of code with SetReplicates(false), the RPC does not get sent. Is there any way I can somehow force the RPC to be sent before SetReplicates gets there first to stop the RPC from being sent? Thanks ๐Ÿ™‚

fossil veldt
#

It's likely because the packet gets placed in a buffer and you're disabling rep before that buffer is sent, I know there's a PreReplicate function, might be worth checking if there's PostReplicate also

#

if there is then you might be able to mark the actor to stop rep and then disable it, optionally if that doesn't work you could just do it on the next pre-rep and that might work too but i'm not that knowledgable on how the actual internals of rep work once it gets to the buffering stage, even if you get to the next PreRep it might drop it, worth testing tho

twin juniper
#

Ah interesting, I'm trying to find the PreReplicate function on the docs but I can't find it. Is that the exact name for it?

#

Ah I think I found it, I believe it's AActor::PreReplication.

slow pond
rancid flame
#

If I have a UPROPERTY(Replicated) and I change its value on the client, does the server update to reflect that? Or do I have to call an RPC on the server from the client to request that its state be changed?

sinful tree
sinful tree
deep shore
#

@sinful tree Thanks for your response. yes, itโ€™s part of a long chain of functions that run on server when a player takes damage. It runs a check if a playerโ€™s health is at zero, and from there simulates physics and converts the mesh. Whatโ€™s strange is that everything works correctly every time until it reaches the end where the mesh is converted.

sinful tree
#

So then when your player is ready to turn into a backpack, you change the value of that variable on the server so it replicates, and then the OnRep function fires on clients that receive it - including those who may not have received the initial replication of the variable.

deep shore
#

I see what youโ€™re saying. That sounds like the perfect solution. I really appreciate your help with this, very kind of you.

#

@sinful tree ^

dark edge
#

Repnotify on an enum or bool

#

Lol ffs I'm late to the party

dusk basalt
#

I know this isnโ€™t official support, and probably an obvious question, but Iโ€™ve been wanting to make a small multiplayer game for me and my friend, however I have a couple of questions. Is port forwarding the only way to get us linked on 2 different ips (not locally in better terms), if not is it the best option out of the others to go with?

Edit: I have 2 multiplayer classes next semester, that will probably cover exactly this, but I am eager, and all I can find online is port forwarding stuff, and idk if there are other options or not.

vivid seal
#
UPROPERTY(ReplicatedUsing=OnRep_CombatGroup)
UCombatGroup* CombatGroup;
UFUNCTION()
void OnRep_CombatGroup(UCombatGroup* OldGroup);

if I add the CombatGroup object to ReplicateSubobjects, is there a race condition between the pointer replicating and the object itself replicating? if so, do I get a RepNotify call when the pointer stops being null (the object is replicated to the client)?

rancid flame
#

It seems that when players join a server and are spectating, their PlayerControllers don't have a PlayerState? is that correct?

fossil spoke
#

No

#

You always have a PlayerState

#

Obviously normal replication applies here.

#

The PlayerState may not exist immediately.

#

But it will be created.

rancid flame
#

Hmmm, I'm doing something wrong then.
I'm inside a user widget and using GetOwningPlayerState and it's not finding it

#

ah it migth be too early in that case

#

oh yeah, it was too early, nvm

fossil spoke
#

Might be to early or the Widget may not be able to resolve the PlayerState from its Owner.

urban moth
#

hello there.. I am trying to understand how UE4 Network profiler works.. I can see something like FrameMarkers. Is there a way how to add custom marker into frame?

prisma snow
#

Hi! I am trying to use an AAIController to move some Units client-side. I read here (https://forums.unrealengine.com/t/spawning-ai-on-client-only/121202/2) that it is possible to have client-side AIControllers if I spawn them there. I did that and according to the debugger, they exist and execute the movement functions as they would in the server. However, when I play in the client they still don't move. I also checked that "allow client side navigation" setting is checked out in the project settings

keen surge
#

what would be the way to handle shooting behavior, both manual and auto fire?

#

I currently start/stop on client side and have a timer to call shoot...

#

but depending on network quality this can happen:

#

where 2 bullets will be spawned at almost the same time due to the server handling two requests after eachother

thin stratus
#

You should only tell the server that the player pressed or released the key

#

The server can do all the shooting

keen surge
#

alright, so that's what I thought

#

I call a start/stop reliable server and it has the timer and everything else then?

#

will try that out thanks ๐Ÿ™‚

thin stratus
#

Yes

#

There is some prediction you can do on the clients end, but all in all, the should be only 2 rpcs, at least in most common setups

keen surge
#

hmm that's giving me the opposite result ๐Ÿค”

#

now client side sees different bullets than server, I must be doing something wrong haha

thin stratus
#

Your client might be seeing different things cause the bullets get replicated to the client

#

And you won't really be able to change that as long as you make those bullets server auth

#

There is no predictive spawning of actors in UE, at least not out of the box

#

So the client has to wait until their RPC is at the server and then until the actor replicates to them

#

You can use the a Projectile movement component to sync the movement iirc

keen surge
#

yes I have that component, let me see

thin stratus
#

But the bullet can have moved a few units already when it spawns on the client

#

One thing with the projectile movements component is that it has a function called SetInterpolatedComponent or similar

#

You want to call this on BeginPlay or similar and pass in the visual mesh

#

That helps to smooth the visuals

#

CMC does this by default with the character mesh

#

But the projectile move comp doesn't have a fixed owner class so you have to supply it yourself

keen surge
#

SetInterpolatedComponent indeed, let's try that out

thin stratus
#

It won't fix the delay

#

But it fixes teleporting of the mesh when the updates of the location come in a bit slow

keen surge
#

it does look way better already

#

I guess this will do for now, can always come back to it if needed

#

thanks again! ๐Ÿ™‚

keen surge
#

I'll save that and check it out later, thanks!

bitter swift
#

Is there a property in Actors to make it only exist on server? Like a manager class you put in the level

meager spade
#

you wouldn't use AddActorLocalRotation tho..

#

when are you calling this RPC?

thin stratus
#

Did you cut out the Super Call on your setupPlayerInputComponent?

#

Also, not sure why you do jumping like that

#

Jumping replication happens in the CMC

meager spade
#

yeah but they want to do a rotation

thin stratus
#

And yes, AddControllerYawInput is a local thing

meager spade
#

tho not sure why from a jump?

#

problem is, the roation is always going to get overriden by the CMC

thin stratus
#

The whole setup is wrong too

#

You don't want to override input stuff for that

#

What you want to override is the part where the CMC performs the jump

#

And replace it with what you do

#

It's worse if you hack it together

#
/**
     * Perform jump. Called by Character when a jump has been detected because Character->bPressedJump was true. Checks Character->CanJump().
     * Note that you should usually trigger a jump through Character::Jump() instead.
     * @param    bReplayingMoves: true if this is being done as part of replaying moves on a locally controlled client after a server correction.
     * @return    True if the jump was triggered successfully.
     */
    virtual bool DoJump(bool bReplayingMoves);
#
bool UCharacterMovementComponent::DoJump(bool bReplayingMoves)
{
    if ( CharacterOwner && CharacterOwner->CanJump() )
    {
        // Don't jump if we can't move up/down.
        if (!bConstrainToPlane || FMath::Abs(PlaneConstraintNormal.Z) != 1.f)
        {
            Velocity.Z = FMath::Max(Velocity.Z, JumpZVelocity);
            SetMovementMode(MOVE_Falling);
            return true;
        }
    }
    
    return false;
}
meager spade
#

i did mine via gameplay ability (like double jumping etc) hehe, but i can cheat ๐Ÿ˜›

thin stratus
#
bool UYourCMC::DoJump(bool bReplayingMoves)
{
  if ( !CharacterOwner || !CharacterOwner->CanJump() )
    return false;
  
  if (bConstrainToPlane && FMath::Abs(PlaneConstraintNormal.Z) == 1.f)
    return false;

  if (ShouldDoArcJump())
  {
    // New Velocity calculation
    // Velocity = ...;
    
    APlayerController* Controller = Cast<APlayerController>(CharacterOwner->GetController());
    if ( Controller )
    {
      FRotator NewRotation = Velocity.Rotation();
      // Remove Pitch and Roll if needed
      // NewRotation.Pitch = NewRotation.Roll = 0.f;
      Controller->SetControlRotation(NewRotation);
    }

    SetMovementMode(MOVE_Falling);
    return true;
  }
  else
  {
    return Super::DoJump(bReplayingMoves);
  }
}
#

something like that

#

I think Kaos' jumping isn't directly input driven, iirc.

#

It's an ability he lets his characters execute in an RTS style or so?

#

Something something

#

You can do the rotation where the NewVelocityCalculation happens

#

I updated the code above a bit

#

It's pseudo code, so not sure this works 100%, but that would be my first attempt

#

It should

#

Since here you are doing it in the same timestamp

#

If you do it via your own RPC, then the RPC isn't guaranteed to happen at the same time as the ServerMove one

#

So there might be timestamps where they move differently

#

And the move where you do your actual custom jump, which is of course a 1 time call, you might use the wrong rotation

#

No

#

ControlRotation is ClientAuth

#

The Client sends it to the Server

#

The Server applies it on the top red line

#

And the bottom one is what makes you ultimately jump

#

Does your character use control rotation in any way?

#

Otherwise you need to set the Characters rotation too

#

No, as in, the Default Settings of your Character

#

You have these "UseControlRotationYaw" etc. checkboxes

#

Then it should work with the control rotation

#

Why not

#

It's the input based rotation

#

Usually controlling the view

#

Can't aim if you aren't in control

#

I can't recall seeing any Rotation overrides

#

So yeah, it's fully client auth

#

Either way, it should work if you do it in the same timestamp

#

So yeah, try the CMC way

crimson saffron
#

guys, is it possible to implement a leaderboard system for a listen server?

bitter oriole
dark edge
#

Server first is fine if you're ok with lag. Has anyone extended the CMC to handle rotation as well? It's probably not built in as most games don't care about your rotation or rotation rates etc. But if you had a design that needed server authoritative rotation for some reason, I don't see how it's be insane to also handle rotation in the CMC move system.

#

After all spinning a capsule doesn't change anything about it's collision etc.

#

Pitch would be weird.

meager spade
#

we have a overriden the rotation stuff

#

we rotate the player based on mouse location in the world

dark edge
#

I could only see server authoritative or predicted/corrected rotation being needed for a design that had taunts or other forced aiming effects maybe.

#

Or maybe a sim shooter where you don't want ppl doing flick 180s

meager spade
#

CMC does handle rotation

#

void UCharacterMovementComponent::PhysicsRotation(float DeltaTime)

dark edge
#

Does it correct if say you had a server forced rotation? Like a taunt forcing aim direction

meager spade
#

you should use control rotation for that

#

we use that for focusing the player

#

never had issues

dark edge
#

Do you have a separate rotation you replicate for pitch visualization on other clients or how do you sync that

thin stratus
#

UE4 replicates the Pitch already

#
FRotator APawn::GetBaseAimRotation() const
{
    // If we have a controller, by default we aim at the player's 'eyes' direction
    // that is by default Controller.Rotation for AI, and camera (crosshair) rotation for human players.
    FVector POVLoc;
    FRotator POVRot;
    if( Controller != nullptr && !InFreeCam() )
    {
        Controller->GetPlayerViewPoint(POVLoc, POVRot);
        return POVRot;
    }

    // If we have no controller, we simply use our rotation
    POVRot = GetActorRotation();

    // If our Pitch is 0, then use a replicated view pitch
    if( FMath::IsNearlyZero(POVRot.Pitch) )
    {
        if (BlendedReplayViewPitch != 0.0f)
        {
            // If we are in a replay and have a blended value for playback, use that
            POVRot.Pitch = BlendedReplayViewPitch;
        }
        else
        {
            // Else use the RemoteViewPitch
            POVRot.Pitch = RemoteViewPitch;
            POVRot.Pitch = POVRot.Pitch * 360.0f / 255.0f;
        }
    }

    return POVRot;
}
#

Other clients won't have the Controller, so they end up in the RemoteViewPitch part

dark edge
#

Ya the disconnect between base aim and control rotation had always thrown me for a loop.

thin stratus
#

Yeah functions are named like dogshit

dark edge
#

Or the fact that they are separate and we don't just have 1 variable rather.

thin stratus
#

Could have just been GetControlRotation on the Pawn

#

That returns it from the Controller or a replicated version if non exist

#

But well

meager spade
#

Pitch is replicated seperatly tho

#

which is why they do this

#

strange, but hey

#

possibly cause you dont ever want to pitch your control rotation

thin stratus
#

Yaw is inherited from the Actor Rotation

#

Same as Roll I guess

#

Probably all comes from UE being UT Engine at first :D

quiet fjord
#

Guys a question how could I replicate the camera of a player so that the player who dies can see his camera and see how he moves because currently I take the last position and he does not replicate his movement

winter plover
#

sooo my gamestate isnt running BeginPlay on my clients

#

and i have no clue why

#

where should I begin looking?

kindred widget
#

@winter ploverAs in any actor at all?

#

That sounds like the wrong game state class with the wrong game mode.

#

If it's a specific actor, I'd look at relevancy. Make sure the client is actually getting the actor.

winter plover
#

as in the gamestate actor

kindred widget
#

Would make sure that your GameState/Mode both inherit correctly.

#

GameMode needs paired with GameState. GameModeBase needs paired with GameStateBase.

winter plover
#

the blueprint gamemode was indeed parented off of GameMode, not GameModeBase

#

and it seems like that solved the issue

pallid token
#

When I launch my server with:

"G:\UnrealEngine\Source\Engine\Binaries\Win64\UE4Editor.exe" "G:\UnrealEngine\Projects\IntConBasMMO\IntConBasMMO.uproject" MultiplayerTestinMap -server -log

and my client with:

"G:\UnrealEngine\Source\Engine\Binaries\Win64\UE4Editor.exe" "G:\UnrealEngine\Projects\IntConBasMMO\IntConBasMMO.uproject" 127.0.0.1 -game -log

The UI loads, and I'm getting responses in the log with with UE_LOGs, but the viewport is just black. Any advice?

pallid token
#

Lol.... Typo.

rocky topaz
#
    UFUNCTION(reliable, server, WithValidation)
    void ServerStartFire();
``````cpp
bool AShooterWeapon::ServerStartFire_Validate()
{
    return true;
}

void AShooterWeapon::ServerStartFire_Implementation()
{
    StartFire();
}
#

Is there any reason WithValidation is used here?

#

yeah I think I'll remove validation as i'm the only dev

#

and it has a lot of internal checks anyway

thin stratus
#

Preeetty sure it doesn't allow Reliable without WithValidation

#

So you will have to use it :D

#

And Unreliable is wrong here

rocky topaz
eternal canyon
thin stratus
#

Then they changed it recently

silent valley
#

yeah I think it was 4.27 they changed it

thin stratus
#

Well, it reminds you when compiling usually

#

Ah okay

#

I haven't used 4.27 yet

rocky topaz
#

I'm pretty sure it changed before

#

I've used it on 4.26

thin stratus
#

Well it's all fine then. My info is outdated then

silent valley
#

could be 4.26, I know for sure it was a requirement on 4.25

#

I actually don't recall the last time I wrote a Reliable RPC... ๐Ÿ™ƒ

rocky topaz
#

the issue doesn't seem to be from your moveright or moveforward

#

did you change something else?

#

are you using the default CMC?

#

does your floor have CanStepOn set to true?

kindred widget
#

That's odd. I swear I've written reliable RPCs in 4.25.4

#

Without validation.

rocky topaz
#

did you mess with maxwalkspeed?

eternal canyon
#

Same with 4.24

bitter oriole
#

Mandatory validation was dropped around that time

versed ocean
#

anyone able to help me understand why this method never fires?

#

from my server client it does, but from a connected client, it doesnt do anything

dark edge
#

Do you own the bow?

versed ocean
#

yeah

#

oh

#

wait

#

perhaps not... let me look, and thank you for a spot to look

#

I believe it is owned by my Player character what would determine that exactly?

dark edge
versed ocean
#

nope BP_StarterBow is the owner

#

I could have done this wrong I'm pretty new...

shrewd tinsel
#

is attaching actor to actor replicated?

kindred widget
#

Actor attachment should be replicated, yes.

#

Should only have to call it on server if memory serves. Though there are a few reasons to do it on client via pointer onrep.

winged badger
#

4.25 works too

winged badger
kindred widget
#

Fair enough. ๐Ÿ˜„

winged badger
#

without the parent net addressable, or with it being instanced, you end up with something like that bug you had stepping on an ISM component

kindred widget
#

Teleporter pads!

#

Thanks for reminding me. Still sour about Static Mesh On Rep. :/

dark edge
#

Does replicated movement work on the level of relative movement or world movement? That is, of you attach actor B to actor A, and move actor A around, is B eating up unnecessary bandwidth or is it smart enough to realize that it only has to replicate if moved relative to A?

#

Or in my case, attaching actors B-Z to actor A, sometimes more.

solid raft
#

Anyone have any ideas as to how to go about troubleshooting an issue with a local dedicated server? https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/Networking/HowTo/DedicatedServers/

following this article, the server gets stuck on bringing the level up, and doesn't proceed further:

[2021.11.18-17.17.22:597][  0]LogWorld: Bringing World /Game/Maps/Maps/ServerMap.ServerMap up for play (max tick rate 30) at 2021.11.18-08.17.22
[2021.11.18-17.17.22:597][  0]LogWorld: Bringing up level for play took: 0.002848```

But I understand when its working fully, it reaches a state displaying "EngineInitialized" and LoadMap(). I have to assume this is what is preventing me from connecting to it.

On the client side, no errors are showing up:

LogNet: Browse: 127.0.0.1/Game/Maps/Maps/StarterMap
LogInit: WinSock: Socket queue. Rx: 32768 (config 32768) Tx: 32768 (config 32768)
LogNet: Created socket for bind address: 0.0.0.0 on port 0
PacketHandlerLog: Loaded PacketHandler component: Engine.EngineHandlerComponentFactory (StatelessConnectHandlerComponent)
LogNet: Game client on port 7777, rate 100000


Surprisingly, the game works fine networked in our server provider, or even set up as a listen server. 

Any suggestions are greatly appreciated
round star
#

I am feeling incredibly stupid. I print the value at the end to check if its actually 0 or less..which it is..but it still goes through the brtanch

#

neevrmind I got it

rocky topaz
#
//Pawn::PlayDying sets this lifespan, but when that function is called on client, dead pawn's role is still SimulatedProxy despite bTearOff being true. 
void AShooterCharacter::TornOff()
{
    SetLifeSpan(25.f);
}
```anyone knows why super isn't called here (and why is this like this)?
rancid flame
#

So I want to show each player's name above their head in-game. Inside ACharacter::PossessedBy I'm using APlayerState::GetPlayerName() to set text on a UWidgetComponent on my character.

But this doesn't work for clients, the text is only correct on the serve servers.

The name isn't really important so I thought each client could do it themselves without having to do replicated stuff. But PossessedBy only seems to be called on the server?

Alternatively if I make it fully replicated, I'd have to make the component, the widget and the text widget itself replicated?

Is there an easier way to do this?

rocky topaz
#

but since it could also not have it you need to make PlayerNames themselves replicated and make it so that when they get replicated they update the widget texts

#

sorry I've never used this so I can only give you the logic I'd follow to solve it

rancid flame
kindred widget
#

I personally find replicating text pretty pointless, but that's mostly out of habit of localization. Playerstate's beginplay should probably broadcast a delegate for name update. UI should probably bind to that and also try to set it when the ui is initialized.

#

@rancid flameCould also override Pawn's Playerstate onrep.

#

May not have the name by then. But could set up bindings to receive it when it is set.

#

There's a virtual onrep for PlayerName as well.

neon mango
#

When running in editor with viewport as listener and a second window as client, get player controller of 0 returns the viewport pawn all the time and 1 returns the client? But in a packaged game running on two different machines, 0 should always return the pawn the player is controlling right?

kindred widget
#

@neon mango'should'. Though there are conditions where this can fail. They're rare, but they happen.

#

Usually related to servertravel.

#

If you have any C++ ability. Consider making a simple static function of GetGameInstance->GetFirstLocalController

dark edge
#

@rancid flame name is a state. I would on rep it

kindred widget
#

It's already replicated. Just need to override the virtuals for some delegate broadcasts.

dark edge
#

What about associating the name with the pawn though? How does a late joiner know what to put above everybody's head

kindred widget
#

Playerstate's pointer in Pawn is also OnRep and has a virtual override.

dark edge
#

So then the only thing you would manually need to catch would be a name change I'm guessing. Not that big of a deal

winged badger
rancid flame
winged badger
#

and letting it handle any widget components

dark edge
rancid flame
#

I have another question: I want to hide the UWidgetComponent from the player who is controlling the pawn. SetOwnerNoSee seems like it works in single-player but in multiplayer the server owns the pawn so it doesn't work... Is there something else I should be using?

kindred widget
#

Could probably just hide it via IsLocallyControlled.

dark edge
#

Shouldn't the player connection own the pawn?

kindred widget
#

Unless your camera is on the Pawn, then OwnerNoSee should work.

dark edge
#

Unless owner no see doesn't mean the same ownership as is used for calling rpcs which would not be the first inconsistent thing and unreal

kindred widget
#

If memory serves, OwnerNoSee is badly named, it doesn't actually have anything to do with Owner variable. It's camera view.

dark edge
#

Lmao

rancid flame
#

IsLocallyControlled worked ๐Ÿ‘

rancid flame
#

Is there a standard way to get debug cheats working on multiplayer? I'm trying to implement a PlayerKill cheat. I've overridden GameMode::AllowCheats to always return true but setting a breakpoint inside my PlayerKill function shows it's never getting executed

#

How would you do that though, use the local cheat manager and forward the command?

kindred widget
#

Oh. @rancid flame I got mildly curious because I remembered an issue with updating names on players through widgets. Had to go digging. I normally hate delays, but if you implement this normally without the delays, you're going to find an odd bug where ListenServer does not actually update other player's names from a beginplay run. It needs a single frame of time before the name is set correctly on the server.

#

Top is widget, bottom is character with the widget component.

#

Bindings are the ones I mentioned earlier, just overriding the OnReps.

#

Character

h
UPROPERTY(BlueprintAssignable) FBasicDynamicMulticastDelegate OnPlayerStateReplicated;
virtual void OnRep_PlayerState() override;

cpp
void APortalVillagePlayerCharacter::OnRep_PlayerState()
{
    Super::OnRep_PlayerState();
    OnPlayerStateReplicated.Broadcast();
}

PlayerState

.h
UPROPERTY(BlueprintAssignable) FBasicDynamicMulticastDelegate OnPlayerNameChanged;
virtual void OnRep_PlayerName() override;

cpp
void APortalVillagePlayerState::OnRep_PlayerName()
{
    Super::OnRep_PlayerName();
    OnPlayerNameChanged.Broadcast();
}
rancid flame
#

How do you type in cheats in your project?

meager spade
#

i use cheat manager o_0

#

can spawn items, pickups, give god mode, inf ammo, etc

#

and that then gets compiled out in shipping build which is the benefit to it

neon mango
kindred widget
#

I don't know the exact reasons. I know I walked face first into it like my first month where I work because I thought I knew how to use GetPlayerController0 correctly. ๐Ÿ˜„ Then Kaos up there crashed on it.

neon mango
#

That is in PostLogin

#

So when post login fires I'm trying to set a player index

kindred widget
#

It's one of those things where 99% of cases it's fine if you use it correctly. The other 1% will bite you in the ass. And with enough players, 1% is a bad thing. ๐Ÿ˜„

#

Ah. Why index on the State?

neon mango
#

wdym?

kindred widget
#

In general, relying on index isn't a good idea. It should never matter in what order players join/leave your game.

neon mango
#

the order doesn't matter

#

Someone log's in, they get 1, second person joins, they get 2, so on...

#

Then I set in their player state to remember it

#

but I seem to only get 1.

kindred widget
#

Yeah. Then player 3 logs in. They get three. Then player 2 leaves, and now you have to update player 3 to player 2.

neon mango
#

Not a big deal

#

That is why there is a logout to handle

kindred widget
#

It's unnecessary upkeep though. Why do clients need to know in which order other players joined?

neon mango
#

But Player Array is inaccurate

#

Tangent aside, Player Array should be accurate

#

But does not seem to be

kindred widget
#

PlayerArray is fine. Unless you're using it too soon.

neon mango
#

let me delay

kindred widget
#

If you're using C++, there are overrides you can use to add delegates for UI update in GameState if memory serves whenever a playerstate adds itself to the array.

neon mango
#

So tell it to spawn 3 players in editor

#

I wait 10 seconds

#

10 seconds later first PostLogin fires

#

Guess what the length of the player array is? 1 lol

#

That doesn't seem right

kindred widget
#

You're checking PlayerArray in PostLogin?

#

The might be too early for that. Sec.

neon mango
#

10 seconds cannot be to early

kindred widget
#

Wait. What settings are you using?

neon mango
#

Settings in terms of?

kindred widget
#

You're running as Listenserver or?

neon mango
#

Yes

#

Listen Server

#

3 players

#

or 2

#

It is like GameMode is resetting or something

#

Even if I put a Counter, and increment TotalPlayer by one every time PostLogin fires it just prints out 1 for total players?

kindred widget
#

Not sure what the issue there is. I've never seen that happen. If I print with no delay in PostLogin the length of PlayersArray with three players. I get the correct count.

neon mango
#

Even though the counter gets called X times

#

So very confused

kindred widget
#

You're not networked for some reason.

neon mango
#

hmmm

#

OMG

#

Sorry

kindred widget
#

When networked. Printstring will always show Server: or Client:

neon mango
#

Looks liked it switched to stand alone

#

Good catch

#

Ok let me start testing again

#

Yeah that was it.. Facepalm

twin juniper
#

Hey guys! Can anyone recommend the minimum amount of spell cast time time for a multiplayer game? So higher ping players could also react...

neon mango
#

@kindred widget Now with the proper player Index I can get the right player controller server side

winged badger
#

@neon mango PlayerArray is not replicated, rather the PlayerStates are

#

they register with the GameState when they arrive on clients

neon mango
#

It was working I forgot or didn't realize the switch to stand alone.

winged badger
#

via Add/Remove Player functions in GameState

#

both virtual

#

and both can be overriden to fire OnPlayerJoined/Left locally

neon mango
#

ok

winged badger
#

and @kindred widget is quite correct, i watched him faceplant on GetPlayerController[0]

#

the only thing that is really good for is

#

splitscreen, or iterating over all PCs from blueprints

neon mango
#

Well right now as shown in my screen shot above, damage is done server side, so my issue was that the Player Controller 0 was returning 1st player or a single player every time. I kept thinking the player controller is local on this machine should return the right one but this overlap happen server side only and there Get Player Controller 0 doesn't mean what I think it means client side. So now I get the right index PC and it works

#

Gotta get back into the MP mindset...

winged badger
#

getting PC[0] connected to a RPC is a good way to crosswire your entire game

#

GetGameInstance()->GetFirstLocalPlayerController() from any actor gets the correct controller every time