#multiplayer

1 messages · Page 477 of 1

thin stratus
#

Then it would be okay

high current
#

there needs to be some check from the server, always

thin stratus
#

So the Client says when and where to drive and where they are

#

the Server accepts it (which should already happen in the Vehicle Movement Comp)

#

And sends it the simulated clients

#

And then you just need to make sure that the Movement of the Vehicle is not marked as replicated

#

cause otherwise it will be overridden by the server again

#

which you don't want

#

Not sure if that all stays in sync though, cause as said, physics aren't deterministic

#

Might be that the Car on the Server drives agains a stone and flips and the one on the client doesn't

#

and then the Client will correct the Server next frame :P could look a bit laggy sometimes

pallid mesa
#

in short for a client authorative approach ~ always trust but verify

thin stratus
#

If you really don't care about cheating then don't verify but at least make sure you know how you could verify if neede

pallid mesa
#

Also, eXi, your explanation could be pinned, it was great

limber mortar
#

I would like to verify, I might not care too much at the moment but still want to prevent it if possible

#

and who is to say they won't develop an E-league for my awesome game!

#

Thank you for all the help and advice guys

#

I am looking into setting this up

thin stratus
#

Would rather write a blog entry one day

#

And maybe even support that with proper code example :P

high current
#

Oh btw, you have the Run Dedicated Server ticked under play settings in PIE right @limber mortar

#

@thin stratus or update the compendium with stuff like this

thin stratus
#

Also, one little thing: my game doesn't work in PIE like it does my dedicated server
That is usually not normal. There are a few things where I would say that it could show differences and it's good to test packaged builds, but if you do everything correctly, it should work in PIE and packaged.

limber mortar
#

Thanks for that

thin stratus
#

You never know why it's fixed between PIE and package build, you could just be lucky that it doesn't occure

limber mortar
#

that has always bugged me

pallid mesa
#

I don't think the compendium is appropiate for that kind of information. But still, if you do plan on doing that you would be the internet hero, since there is almost no code examples on movement replication aside a couple experiments.

limber mortar
#

oops

#

misread that

thin stratus
#

You I know. I've been through replicating HoverMovement

limber mortar
#

It does work like PIE and on the server

thin stratus
#

Wasn't funny

limber mortar
#

it doesn't work in standalone the same

#

testing in UE4

thin stratus
#

Sadly my only reference is the CMC and that is not really the best resource

#

Would need to figure out a better system first

pallid mesa
#

Well if you strip out all the bs from the cmc it does the basics

thin stratus
#

But maybe it's enough to just break down the CMC into all the replication parts (and cut away the Root Motion stuff no one needs)

pallid mesa
#

we said the same thing, yeah

thin stratus
#

hehe

high current
#

the thing is pie/dedi server is that if you are simulating multiple clients on PIE, they are instant and on the same machine, and errors in replication are still there but you might not notice them due to how fast everything gets checked and reset by the server, at least that is my experiance with it

thin stratus
#

Too fast connection can actually cause weird stuff

limber mortar
#

oh that makes a lot of sense

thin stratus
#

I had people connect so fast that BeginPlay hasn't called yet

#

So I had to force it in PIE

#

But that's really rare and even then it shouldn't cause many issues

pallid mesa
#

single process on?

thin stratus
#

Think so

high current
#

Hah, I had that begin play thing as well

pallid mesa
#

turn it off and try again, also be careful with HR

thin stratus
#

Not really caring about that as we usually just make it work in PIE to a point where the logic works and then push out a test build anyway

pallid mesa
#

well where I work at we are having 2 bugs we can't replicate in the engine at all

thin stratus
#

Which are?

limber mortar
#

This has been a real productive business meeting, I love you guys

#

I learned a lot

pallid mesa
#

they are related to attachments and cmc being dormant on unpossess

#

it's long and weird

#

If I get permission by my studio I'll post it in lounge, it's quite hilarious

thin stratus
#

Sounds annoying. Idk what is more annoying, not being able to reproduce a bug

limber mortar
#

^

thin stratus
#

Or finding it on the issues page as "unresolved"

high current
#

why not both

pallid mesa
#

I think it's worse seeing a "backlogged or a won't fix"

#

I cry every time

thin stratus
#

I have one that is not fixed yet I think. lemme quickly check before I go to bed

#

LOVELY

#

MOVED TO 4.24

#

(╯°□°)╯︵ ┻━┻

high current
#

I am still on broken 4.15 unreal tournament replication, and its a nightmare when I cant reproduce what I see in the replay system AT all in the editor

thin stratus
#

UT has so many coding errors

high current
#

And I love when issues are fixed after 4.15

thin stratus
#

They literally try to cast the GameState to a GameMode at some point

high current
#

and I just shrug

pallid mesa
#

what (bis)

#

okay okay this is epic

#

😂 get it?

high current
#

Ik, my fav thing is where GameMode sometimes slips up and actually succesefully casts to a client

pallid mesa
#

o__O

pallid mesa
#

hahahahah

thin stratus
#

Guess these controllers don't need restarting

#

They also have a bug in their Respawn Countdown.
It's a repNotify that is constantly set to the same value

high current
#

Gotta hand one thing to Epic for UT tho, they have a veery cool and neat UTLocalMsg system

thin stratus
#

The first time it shows "You can respawn in x seconds"

#

The ongoing times it says "Press fire to respawn" even though you need to wait

#

I've been through my fair share of UT bugs xD

pallid mesa
#

ULocalMessage is a UDK thing Tapa, it's been there for a long time

thin stratus
#

anyway, g2g to bed!

high current
#

from GM you can broadcast messages, which would display text, but they also have On Client PC recieve fuction which fires on the client and you can

pallid mesa
#

I could spend the night speaking, but people need to go to sleep hehe

high current
#

ah nvm then

pallid mesa
#

good night!

high current
#

its cool anyway

#

gnight

limber mortar
#

Thanks again cedric, night

#

Appreciate the help as well Tapa

high current
#

well, I was the supporting helper here, but thanks ;p

limber mortar
#

You gave me useful information

#

and I believe that test with the physics being applied while not in possession of the pawn helped eliminate some potential causes too and it was not a test I had run yet

high current
#

Yeah that stuff can tell you if your issue is due to user input or the actor setup to begin with

limber mortar
#

Great logic to follow

flint rose
#

I'm having issues with an anim notify not consistently firing on the server. The animation is correctly played on all clients/server. What could cause this?

high current
#

Is said anim notify exactly near the end of the animation?

flint rose
#

There are many, but the specific ones I care about are near the middle

high current
#

when does this occur, when playing in PIE as only dedicated clients

#

or when your server has a viewport

flint rose
#

It doesn't happen to the owning client (when no dedicated server), but other clients will experience the issue

#

When running as a dedicated server, it occurs for everyone

#

Sometimes it does fire though

#

Hmm, it may actually be firing correctly, but the debugger may be messed up

#

I may actually have a casting issue

#

No, it's not a casting issue. 😦

#

Let me get a video of what I'm seeing

#

Now I'll get a video of local listening server

twilit swift
#

I'm trying to pull some info off of UNetConnection to do a bit of optimization. I'm basically using the APlayerController::GetNetConnection() function and from there:


    if (PC)
    {
        UNetConnection* NetConn = PC->GetNetConnection();
        if (NetConn)
        {
            InBytes = NetConn->InBytes;
            InBytesPerSecond = NetConn->InBytesPerSecond;
            OutBytes = NetConn->OutBytes;
            OutBytesPerSecond = NetConn->OutBytesPerSecond;
            InTotalPackets = NetConn->InTotalPackets;
            InTotalPacketsLost = NetConn->InTotalPacketsLost;
            RemoteSaturation = NetConn->RemoteSaturation;
            StatPeriod = NetConn->StatPeriod;

            return true;
        }
        else
        {
            return false;
        }
    }```

This works on connected clients, but not on the server. Does UNetConnection only exist on the client?
flint rose
#

Here is a picture of the animation being played (it's part of a montage with 3 total attacks)

#

@twilit swift , are you calling that from the player state?

#

Or gamestate

twilit swift
#

I'm actually calling it from GameInstance.

flint rose
#

Then I believe it makes sense that it is returning null, since that is the servers copy of your player controller

twilit swift
#

Hmm... ok. So, is there a UNetConnection for the server?

flint rose
#

That would depend if that player controller is owned by a listening client

#

If you're just trying to access that information, you could just do an RPC with that data to the server

#

But maybe I'm not fully understanding what you're trying to achieve

twilit swift
#

I'm trying to get these stats during runtime in a shipping build. I want to see the stats on each client as well as on the server and see what's causing bad spikes in network traffic, etc.

high current
#

@flint rose put some print strings on those events, as pawn owner might fail on non authoritive clients

#

eg owning

flint rose
#

I had just tried that MrTapa. 😦

twilit swift
high current
#

And yeah, the active oringe blueprint wires

#

dont always show the correct thing

#

so always have print strings and breakpoints

flint rose
#

I'm still seeing inconsistency within the debug messages

#

@twilit swift , I think your best bet with my limited knowledge would be to send a reliable message to the server with this data

#

You could easily set them as variables on the player controller and make them replicated

#

And the server could get access to them directly from the player controller

twilit swift
#

My concern there is that if they're replicated variables then the stats would be the same for all clients and the server. It seems to me that there should be more data moving through the server than a connected client. Maybe I'm confused.

high current
#

the inconsistencies are wierd. But in your case actually debuging with draw debug spheres on the location of the blade would be the most helpful thing

twilit swift
#

I don't want to code something to pass the data along and then find out that there's actually a TON more data moving through the server than I'm printing out.

flint rose
#

A Debug sphere?

#

The weapon should have little to do with the anim notifies firing.

#

The animation is played on the character mesh

high current
#

no yeah, I am just pointing out a useful debug thing

flint rose
#

Ah.

high current
#

Have you looked at the conditions of the anim notify blend spaces

flint rose
#

This is within a montage, not a blend space

#

Is there something similar for montages?

high current
#

so you are startign the montage from the char bp?

flint rose
#

From C++ in the Character class

high current
#

and that stuff is replicated right

flint rose
#

The server is then sent a message to multicast

#

The animation

#

It's important that the server plays the animation due to the root motion

#

Else the character would constantly be getting thrown back to it's original location

glad sedge
#

@flint rose Should animations always play on server, or just multicast if they don't involve root motion?

high current
#

ok are you using repnotify toplay the montage

flint rose
#

@glad sedge , if you ahve root motion, you should play on the server. If not, I wouldn't play it on the server to save CPU

glad sedge
#

Cool.

flint rose
#

I'm doing something like this: animInstance->Montage_Play(MontageToPlay, 1.f, EMontagePlayReturnType::MontageLength, 0, true);

high current
#

So to recap, visually everythingworks, the rep notifes always fire but inconsitently(timings)

#

or som rep notifies dont fire

flint rose
#

Some don't fire

#

But will sometimes

high current
#

wierd

#

are your notifies inside the clips

#

or inside the montage

flint rose
#

They're in the animations.

#

Currently,

high current
#

try doing them in the montage

flint rose
#

Previously they were in the montage because I wanted to see if it would make a difference

high current
#

ah

#

and have you tried putting these animations inside the anim BP

#

and relying on a blend

flint rose
#

I don't think it would work with the root motion unfortunately

high current
#

how so

flint rose
#

How do I enable root motion on a blend?

high current
#

root motion should be encoded in the animation, shouldnt it

flint rose
#

Server root motion should only be donee through montages

high current
#

tough cookie

flint rose
#

Yep

#

I could send messages from the client to the server to enable/disable weapon collision. But that's a bad idea

#

And latency could be hard to deal with

#

I could also use timers

high current
#

I mean, root motion is hard to sync via network

#

in any case

flint rose
#

I have it syncing perfectly. 😦

#

So I don't really want to touch it

high current
#

u tested with ping?

flint rose
#

I don't see issues with anything under 200ms

high current
#

cool stuff

flint rose
#

This is only my 3rd week in UE4.

#

And half of it was spent getting that working. lol

high current
#

I havent worked with animations in a loong time

#

but cant you access the root motion settings of the mesh from the character?

flint rose
#

Root motion settings exist in the animations themselves

#

But you need to tell the character to ignore its movement controller while it is happening

high current
#

last thing I can suggest it to try to play the montage trough the Anim BP

flint rose
#

The AnimInstance is the BP

high current
#

Ah, I thought you are playing it from the character pawn

flint rose
#

void AComboCombatActionCharacter::PlayMontageInMesh(UAnimMontage* MontageToPlay) {
UAnimInstance* animInstance = GetMesh()->GetAnimInstance();
TextColor = FColor::Green;

animInstance->Montage_Play(MontageToPlay, 1.f, EMontagePlayReturnType::MontageLength, 0, true);

}

high current
#

I see, ok then as a hail mary, try creating a boolean on the pawn, which is rep notify

#

in the rep notify play the montage

#

But otherwise I am out of ideas man...

flint rose
#

Yeah. Me too. 😦

#

The montage is definitely playing

#

Just not all 4 notifies are firing on server

#

I'll get at least 1 every time

high current
#

No yeah I know, but there are slots, priorities and so on

#

or so I have heard

flint rose
#

I'm only using 1 slot

#

Maybe it's just a bug within UE

#

Thank you for all the time brainstorming with me. I appreciate it

high current
#

anytime

flint rose
#

Hmm, I guess I could allow the client to say, "hey, I hit this character", and then validate it on the server. But of course, this can add to issues with latency

high current
#

I mean yeah, there are many ways to fix the issue with external stuff, but you want to get the notifies to work...

flint rose
#

Ultimately my goal is to just make the other player take damage

#

In a perfect as possible way

#

In my game, you can block and attack other players so making it as precise as possible is important

#

So I guess that idea would work. If they have high ping, it's going to suck regardless

green cedar
#

Is there a solution out of the box that would allow direct remote connections to a server on my localmachine that doesn't allow the remote clients access to this computer's IP address?

#

A proxy or something similar

#

Or would any solution that involves content being served from the local machine necessarily open it to bad actors?

spring swift
#

i am absolute trash at multiplayer

#

question, is there anything wrong with spawning and possessing players through the game instance????

#

i think my game might be at the point of no return. ive pulled apart the player spawning system so much that idk whats what lol

high current
#

whats your reasoning behind doing so

#

normally I wouldnt touch my game instance for anything other than simple data saves n such, but that is just me

spring swift
#

well the instance is on the clients side right?. spawn a player and possess it through the client

high current
#

what drives you to do the spawning yourself

#

typically when a play joins, GM is called, a player controller is assigned and then a pawn is spawned and possessed at a player start

spring swift
#

well, i am attempting to create a player class selector

high current
#

I see

spring swift
#

yeah. it added a very large spanner in the works

#

for me anyways

high current
#

I did an 8 week prototype for an esports mp game

#

the way I handled it there

#

was that my default pawn class was dummy pawn with a camera and no controls

#

I spawn that and set view target to my player class selector

#

player chooses its class locally, and the server ( i think it was GM) spawned it and possesed it

#

so I was actually using spawned actors in the level

#

and GM

#

Do your thing in GM and game state

spring swift
#

well i did at one point manage to get players spawning in my level fine, but ive pulled that apart XD

#

can u explain the gamestate???

high current
#

Game State is where you store your logic

spring swift
#

ive tried to use it but really cant figure that one out

high current
#

which you want the PLAYER to have access to

spring swift
#

can u cast to the gamemode from the state?

high current
#

GameMode is your MOTHERSHIP, it has all the rules and figures stuff out and tells GameState what/how when to do(if it concerns the players)

#

yes you can

spring swift
#

hmm ok

high current
#

but because GameMode only exists on the server

#

GameState cast to GameMode will only succeed on the Authoritve version

#

meaning the server version of the game sate

spring swift
#

ok yeah

high current
#

thats when replication comes into play

spring swift
#

lol, replication and physics is a pain, just saying

high current
#

you can replicate events, so that if GM tells GS something, then GS can say, hey, server version of ME has that info, now Ill share it with the rest of the clients (multicast)

#

yeah, tell me about it, somehow I always end up making multiplayer games with physics...

spring swift
#

lol

#

just one last thing

#

if i was able to spawn the player through the game mode, how will i be able to tell the server that "This client" is the possessor of that player character? because ive tried using the player Index and man i cant figure it out

high current
#

thats why you actually do it from the client and UP

#

at least I do it that way

#

because I am lazy to sort indexes and stuff

#

so scroll up to what I explained at first

#

because remember

#

every client

#

has player starte

#

player controller

#

and pawn

#

both on the client

#

and on the server

#

and since the server is the owner

#

you as the client acan request stuff to be done on the server version of you

#

so from you as a pawn or you as a PC (the client) you can say, hey run this event on my server version, from which I can get game state and run the custom event wihch will sucessefully assign me e a new pawn

#

and you are passing your player controller reference along the way

#

that make sense?

spring swift
#

yeah

#

ima just clean mu rubble and note this all down

high current
#

😄

#

gl with your thing, gotta sleep

spring swift
#

enjoy ya sleep

spring swift
#

ok i did it but i also didnt??? its successfully spawning and possessing apparently but nothing is happening to the client

spring swift
#

has anyone made a game with a character selector before??? if you are you able to show me how you had done it??? im still stuck on this on

velvet parcel
#

So what is the first thing I need to worry about if the game functions perfectly correct in multiplayer mode while in standalone on the editor but has all kinds of problems when I make a dev build.

bitter oriole
#

Well, look at the problems one by one

#

And make sure to configure your game with PktLag set to like 50, so that the editor behaves somewhat like a real game

#

Bad netcode might work perfectly fine in editor

velvet parcel
#

kk

#

ill put pktLag to 100

#

wait where is the lag setting?

#

@bitter oriole

bitter oriole
#

Google pktlag, you'll find a full article

velvet parcel
#

It seems like the issue is because sometimes it takes longer for the player state to actually exist before I set the variables in the player state

#

I feel like maybe I need to do a function where I absolutely make sure everything exists before I allow the player to properly load

fluid prawn
#

Question regarding replication of Velocity in UE4

#

I inherited the custom movement component class and overidden calc velocity and phys falling to do some custom acceleration and velocity modifications. I was wonder if there is a way to properly replicate the velocity modifications without having to clip input from changing the max speed value?

#

I figured I could just modify the velocity in the class and it should replicate but its not the case.

thin stratus
#

@velvet parcel UE4 has these functions in C++ usually.

#

PlayerState exists on PlayerController and Pawn.

#

Both classes have an OnRep for the Client, which calls if the PlayerState is available (can also call when it's destroyed).

#

Which is the place you would access the PlayerState on the Client if needed.

#

For the Server you can use InitPlayerState on the PlayerController

#

As well as I guess Possessed on the Pawn

#

BeginPlay on Pawn is 100% too early and on PlayerController I would say it can be too early if you are unlucky, don't know the timing there.

#

@fluid prawn Velocity isn't replicated.

#

Client performs a Move, ends up with new Location (and thus new Velocity). Client tells Server to perform the same Move, passing the new location with it.
Server performs move, ends up with new Location (and this new Velocity). Server compares Location with the one the Client send and sends a correction if needed.

#

CalcVelocity is called on Server, owning Client and I'm pretty sure also on the Simulated Clients.

#

So if you modify Velocity there, it should be okay.

#

And now a question from my side: Anyone done some good, reliable weapon spread?
Currently have a Replicated Random Seed that gets set when the Weapon is spawned and I haven't done much thinking about utilizing it yet.
Right now it's just used to pull some random values for the Spread when FireTransform is requested. However if Client/Server/Simulated don't shoot the exact same amount of times, the Spread will go async I assume.
Any better solution?

fossil spoke
#

@thin stratus I replicate a Random Integer, which OnRep uses to seed the next random stream value.

#

The Integer is set by the Server after a shot is fired, to seed the next shot.

thin stratus
#

Right, but the what about client Prediction then?

#

The Client can't wait on the Server for that

#

Right now I have:

  • Client Presses Fire
    -> Client fires (FX only)
  • Client tells Server to fire
    -> Server fires (Damage & FX on ListenServer)
  • BurstInt replicates
    -> Simulated Clients fire (FX only)
#

And the three -> have to produce the same spread. Simulated isn't THAT important, but at least the LocalClient and the Server have to do the same

#

And I'm a bit against having the Client tell the Server what Spread to use

fossil spoke
#

Let me double check, im pretty sure it was for Spread, might not have been.

thin stratus
#

The whole idea of having the shot not go exactly where you aim but randomly offset is called WeaponSpread or?

#

Not that there is a more often used term that I forgot

fossil spoke
#

Ah sorry not for spread, using it for a random projectile movement related thing.

#

In my case it doesnt need to be predicted as it already has the value before another needs to be calculated.

thin stratus
#

So when shooting you preduce the value for the next shot?

#

Not for the current?

fossil spoke
#

Yeah but its not for shooting. Its for rebounds of projectiles. The previous rebound calculates the new value for the next one.

wise depot
#

Is there anyone around who has worked with xbox live and UE4 that could DM me to discuss an issue i'm having?

#

@thin stratus regarding weapon spread, can you not have the server seed rand and give that seed out to everyone? then everyone will (or should) see the same spread? Might want to seed it every so often to account for packet loss etc and people getting out of sync but that should work?

#

that way if the spread is calculated using rand then if clients and host all have the same seed per player per weapon per time frame (or something) then it should be the same across all with only the server dictating it?

thin stratus
#

That's what I'm doing minus the refreshing of the seed

#

But I feel like this isn't the best solution

#

A lot of peeps write that Random Spread is pretty much shit for skill-based games

#

Which I can guess is true, I would much rather have a predictable spread like a weapon in CS

wise depot
#

yeah, a lot of games have a set spread rate/direction

thin stratus
#

I would love to see an implementation of that though ;-;

#

Does ShooterGame have that?

wise depot
#

i don't think so

thin stratus
#

(╯°□°)╯︵ ┻━┻

fossil spoke
#

What does UT do?

wise depot
#

been a long time since i played UT

thin stratus
#

Not sure what UT does. They have like WeaponStates for Burst fire

#

That's where I find spread values

#

Will look into the fire functions now of the weapons

wise depot
#

doing a system like counter strike though, would it not just be a pitch & yaw increment per shot?

#

with some kind of timeline or curve to help control how much?

#

like longer you are shooting for the harder it is to keep the gun steady so the more recoil it has? might be a nice touch

thin stratus
#

Yeah but we won't have recoil

#

It's not an FPS game

#

I only need the spread

wise depot
#

OH YOU MEAN ACCURACY

#

i seeeeee

#

i mistook sorry

thin stratus
#

Idk, Spread is the only term that comes to mind

#

Aim at point. Press fire. Shot goes a little bit next to it due to spread

#

Or Weapon Spray?

#

.>

fossil spoke
#

Use a lookup maybe?

#

Create some sort of tool to build the lookup

#

Cycle through the lookup

wise depot
#

you could use lissajous curves

#

as a way of calculating an offset

#

might be a bit extreme

#

a much simpler method would be a (very small) pitch/yaw offset to rotate the shot by every shot so when you fire the actual line trace is rotated slightly

#

and have a counter that's replicated to keep things in check

thin stratus
#
FRotator AUTWeapon::GetAdjustedAim_Implementation(FVector StartFireLoc)
{
    FRotator BaseAim = GetBaseFireRotation();
    GuessPlayerTarget(StartFireLoc, BaseAim.Vector());
    if (Spread.IsValidIndex(CurrentFireMode) && Spread[CurrentFireMode] > 0.0f)
    {
        // add in any spread
        FRotationMatrix Mat(BaseAim);
        FVector X, Y, Z;
        Mat.GetScaledAxes(X, Y, Z);

        NetSynchRandomSeed();
        float RandY = 0.5f * (FMath::FRand() + FMath::FRand() - 1.f);
        float RandZ = FMath::Sqrt(0.25f - FMath::Square(RandY)) * (FMath::FRand() + FMath::FRand() - 1.f);
        return (X + RandY * Spread[CurrentFireMode] * Y + FMath::Clamp(RandZ * VerticalSpreadScaling, -1.f*MaxVerticalSpread, MaxVerticalSpread) * Spread[CurrentFireMode] * Z).Rotation();
    }
    else
    {
        return BaseAim;
    }
}
#

That's what UT does

#

Now the guesswork is what is NetSyncRandomSeed

#
void AUTWeapon::NetSynchRandomSeed()
{
    AUTPlayerController* OwningPlayer = UTOwner ? Cast<AUTPlayerController>(UTOwner->GetController()) : NULL;
    if (OwningPlayer && UTOwner)
    {
        FMath::RandInit(10000.f*UTOwner->GetCurrentSynchTime(bNetDelayedShot));
    }
}
#

It's not even setting anything?

meager spade
#

@thin stratus i kinda did spread based on a predictable randomness value and a seeded stream

thin stratus
#

It should technically be in a way that if you are standing still and you are shooting at a wall it sohuld always produce the exact same pattern

#

But still random sort of

#

The pattern shouldn't be a curved line for example

#

Like the AK47 in CS slowly spreads upwards and then to the top right and at max it goes pretty wild between above left&right of the actual crosshair

#

And having that synced between Server and at least Local Client. Sigh, can this be less annoying xD

meager spade
#

issue with randomness, is well randomness

wise depot
#

CS is recoil that you're thinking of though?

#

that's the recoil pattern of the AK?

#

i think?

#

been a long time since i played CS

thin stratus
#

Recoil is the gun moving and actively offsetting the crosshair

#

The spread happens even if you hold the weapon steady

#

Ah RandInit in the UT call sets it to be used by all rand functions

#

Good to know

winged badger
#

you can try to cheat by syncing a random seed for that

meager spade
#

yeah but still the pattern would be random just synched to the server

#

if you want predictable recoil

#

you cant really use random

thin stratus
#

I do have a random seed replicated atm, but that adds too much randomness, as the weapon being fired again after stopping should produce the same spread.
I would need to reset the stream i guess

meager spade
#
{
    AIrisPlayerPawn* OwnerActor = Weapon->GetPawnOwner();

    bool bIsAiming = IsAiming();
    float StanceScale = 1.0f;
    float SpeedSpread = 0.0f;
    float RotationSpread = 0.0f;
    float StanceScale = 1.0f;
    float SpreadScale = bUseSpreadMultiplier ? SpreadMultiplier : 1.f;

    bool bInAir = OwnerActor->GetCharacterMovement()->IsFalling();

    if (bInAir)
    {
        StanceScale = SpreadParams.Spread_Jump_M;
    }
    else if (OwnerActor->GetCharacterMovement()->IsCrouching())
    {
        StanceScale = SpreadParams.Spread_Crouch_M;
    }

    if (bInAir)
    {
        SpeedSpread = FMath::Abs<float>(OwnerActor->GetVelocity().Z) * SpreadParams.Speed_M;
    }
    else
    {
        const float Speed = bIsAiming ? SpreadParams.SpeedAiming : SpreadParams.Speed_M;
        float PlayerSpeed = OwnerActor->GetVelocity().Size();
        SpeedSpread = PlayerSpeed * Speed;
    }

    StanceScale *= bIsAiming ? SpreadParams.Spread_Aiming_M : 1.0f;

    return (SpeedSpread + RotationSpread + Spread) * StanceScale * StanceScale * SpreadScale;
}```
#

i did something kinda like this

#

which gives a predictable spread

winged badger
#

yeah, any desyncs due to packet loss would be permanent

#

if you don't reset the stream

meager spade
#

ut4 synchs the key via the movement component

thin stratus
#

Yeah they do lots of funky shizzle

meager spade
#

thats what netsynch does

#

but it seeds the entire random

thin stratus
#

So if I have a Repl or at least synced random seed for the weapon

meager spade
#

i personally wouild seed a stream

thin stratus
#

Let's say I use 1000 for the weapon at all times, cause I kind want the spread to be teh same

#

I could, every time the weapon starts firing, reset the stream

#

And just hope it doesn't desync until the weapon stops

meager spade
#

as long as server/client both reset the stream

thin stratus
#

Yeah that anyway

meager spade
#

before they do there logic for detecting hits

#

it should be ok

thin stratus
#

I was more worried about it desyncing over time

#

But if the spread resets every time you restart the fire logic

#

I mean if it desyncs in the time of firing 50 bullets without stopping

#

So pulling 50 random values in one go

#

Then I#m unlucky I guess

meager spade
#

i tested with 100 bullets and resynching the seed everytime a shot is fired (as its done local and no rpc's involved apart from movement component ones)

#

and it was consistent even with pkt lag and loss

thin stratus
#

Right, then the only last thing to solve is having this work with the simulated clients. Guess I just want to replicate the start and stop fire event

#

And then let the Simulated client go crazy all by themselves

pallid mesa
#

FMath::RandInit( this is like the std equivalent srand null init

thin stratus
#

Yeah it's a global init

#

So they don't have to pass the seed into it the whole time. I actually use a RandomStream though

#

Seed -> RandomStream -> Rand(RandomStream)

meager spade
#

same

thin stratus
#

Thanks for the input y'all!

fierce grove
#

UPROPERTY(ReplicatedUsing = OnRep_ReplicatedTransform) is their an equivalent in BP

pallid mesa
#

just onrep variables, now BP's onrep are limited

#

since you can't have the old value as a parameter

#

but they do get called on the server aswell

fierce grove
#

I used Rep Notify FTransform would that be equivalent

pallid mesa
#

yes but with the implications I said

thin stratus
#

I feel like they should just pass the old value by default for BPs

pallid mesa
#

I actually use a RandomStream though Seed -> RandomStream -> Rand(RandomStream)
I don't really know how a randomstream serializes so can't tell benefits of that aside having the seed by hand

thin stratus
#

Freaking limitations

pallid mesa
#

oh yeah. Totally, you can't do some stuff in BP's because of that

thin stratus
#

A RandomStream is basically just a disconnected stream of random values

#

You can have multiple ones

#

Instead of applying the seed to the whole FRand

pallid mesa
#

oh okay so it's more like a design decision rather than a performance one

#

all clear, hehe

thin stratus
#

Yeah I can reset the RandomSeed without resetting other random values that should stay totally random

#

I kinda like that more than RandInit

pallid mesa
#

indeed, I've used both but I thought we were speaking about performance

#

either way sometimes is fun looking at how data serializes

real yacht
#

how can i set dedicated port on gameLift?

#

im initializing gamelift sdk like this with specific port

#

if (GetWorld() != nullptr && GetWorld()->IsServer())
{
params->port = GetWorld()->URL.Port;
}
else
{
params->port = 7777;
}

#

but how i see from logs on machine, dedicated server is running on 7777

#

still

#

any hint here?

fossil spoke
#

When are you setting it?

#

If you set it to early before the NetDriver has rolled the port over it wont work.

real yacht
#

in constructo of specific gameMode

chrome bay
#

You can't set it after the game instance has started up

#

It has to be done via command line.

#

Assuming you're using Steam, look at FOnlineSubsystemSteam::InitSteamworksServer()

fossil spoke
#

If you want to tell the process what port to use sure. But for use with GameLift your processes should start at port 7777 and then they will be rolled over as more processes are added.

#

@real yacht You should be telling the GameLiftProcessParams the port its to use when you actually initialise the new process with GaneLift

#

AWS has an example you can look at in their documentation.

chrome bay
#

Steam gets the ports from command line. If you don't give it the correct ones to use (it won't find them automatically regardless of what gamelift does) - then you won't be able to find the session IIRC. It certainly won't advertise properly.

#

Should be super straightforward to get gamelift to pass options to the command line based on port

fossil spoke
#

Our Gamelift setup finds the ports fine

#

We arent using Steam though.

chrome bay
#

That'll be why then

#

If you are using Steam, the ports have to be passed to the command line. Should be easy to do though

real yacht
#

im not using steam

#

@fossil spoke which doc? can you point me in right direction?

fossil spoke
#

There is a full code sample that shows you how to setup the ProcessParams

real yacht
#

yep, but port is hardcoded on 7777

fossil spoke
#

GameLiftProcessParams->port = GetWorld()->URL.Port;

#

That should work fine

real yacht
#

im using that

#

but seem like that

#

ded. server

#

still runs on 777

#

7777

fossil spoke
#

The first one should

#

7777 is the default

#

Then your next one on the fleet would use 7778

#

7779...7780

#

etc etc

#

As more Servers appear on the Fleet

#

You mentioned your setting it in the constructor?

#

I dont know why your doing that.

#

Thats not how you need to be setting up the call to ProcessReady.

#

Which is where you pass the ProcessParams to GameLift

real yacht
#

but in this AWS example, when gameMode is instantiated, sdk is initialized

#

with params, right
?

fossil spoke
#

Its a barebones example. I wouldnt use that in a project...

real yacht
#

so, where should i initialize sdk? what do you suggest?

fossil spoke
#

Our GameLift integration is a GameInstance Subsystem.

#

We initialize it on PostLoadMapWithWorld on the first level that is loaded.

worthy perch
#

I have not fully looked into the subject, but is there a particular reason why you don't just use the command line?

#

Or does GameLift work better with the PostLoadMapWithWorld .

fossil spoke
#

For GameLift specifically if your Fleets are running many many instances, you dont want to have to manually write out all those command line args telling them to change port.

#

PostLoadMapWithWorld is also called after the NetDriver has resolved the processes new port.

#

So therefore your Port should already have rolled over if necessary.

worthy perch
#

Oh, so in this case, your instance tells GameLift?

fossil spoke
#

Yes

worthy perch
#

Oooh, interesting. I had planned to go the other way, from master to server instance.

fossil spoke
#

You have a master server?

worthy perch
#

Not yet, but I plan to.

fossil spoke
#

What are you using GameLift for then?

worthy perch
#

I was more just asking about the general fleet management approach to things. Sorry if I was unclear on that.

fossil spoke
#

Right

#

Yeah i really didnt want to have to manually tell gamelift what to assign each instances port.

#

So this worked out for us.

#

Its important to wait for the NetDriver though, otherwise it will just use the default 7777 port for all instances.

worthy perch
#

I hadn't thought of doing it that way, but it does sound easier.

fossil spoke
#

I found that out the hard way.

#

PostLoadMapWithWorld bound in the GameInstance::Init with just a bool to gate it from trying to initalize gamelift again during subsequent level transitions works great.

#

The first call to PostLoadMapWithWorld occurs after the NetDriver has rolled the port, thats the important bit.

worthy perch
#

Alright, thanks. I will save this for later.

fossil spoke
#

👍

real yacht
#

@fossil spoke thnk, i will try with PostLoadMapWithWorld

#

to bind on that event

meager spade
#

@fossil spoke how did you get on with Subsystem over a uobject manager ?

#

i like the fact they are exposed to bp's by default

#

issue is, you cant create a BP of the subsystem

fossil spoke
#

Yeah they are convenient as.

meager spade
#

still wish you could create a bp from it, and it not create 4 instances

pallid mesa
thin stratus
#

How does one again access Camera Location on Simulated_Proxies on Clients?

#

Trying to Simulate LineTraces but having trouble getting the trace start location that is for the local player the camera (typical crosshair)

tawny rivet
#

Hi slackers,
I'm wondering how best to do a spectator mode for when my players run out of lives or under other circumstances (triggered dynamically, basically) given that the engine already appears to have spectator stuff built in?

#

I want my spectator mode to be a little more than just a free camera

#

like with the ability to view individual players

#

although i can actually just add that functionality to the spectator pawn 🤔

steady briar
#

so im working on some ai but i think my questions better here... maybe. im trying to make sure an animation is accurate between client and server. whats the best way to call/replicate the anim so that it lines up properly?

chrome bay
#

Hmm, you can't really. Normally you just drive anims from some other replicated properties

#

Trying to sync anims though is pretty much a losing battle

steady briar
#

fair enough

#

trying to get some melee stabby stuff using weapon traces. kind of important to be at least close

chrome bay
#

I guess it's no different to playing a fire animation really

steady briar
#

well im not good at much so its all above me really

#

like theres a dozen ways and places to call an animation but each ones a bit different and some are straight up broken

#

also, do sockets update during animation? i can attach stuff to a socket, but if i spawn a projectile or something it seems to come from the original socket location

chrome bay
#

They should do so long as they're the child of an animated bone

summer nova
#

i had an idea for the most disgusting hack ive ever seen for multiplayer replication

#

unreal engine will NOT replicate structs if they are done by pointer

#

but in some cases, you want to use pointers for multiple reasons

#

so what about using a TArray (replicated), of size 1, with a custom allocator, and trick the pointer

pallid mesa
#

if it works it works 🤣

summer nova
#

i need to try it

#

could be a great feature to build a MP game that uses optimized structure-of-arrays for its "components"

shrewd frigate
#

😢 😢

#

I can't figure out how to implement online multiplayer feature for Android. 😭 😭

fleet raven
#

multiplayer

#

"a feature"

sour river
#

What would be the advantage of using Improbable.IO's SpatialOS over the default UE4' multiplayer? Any idea?

summer nova
#

@sour river MMOs

high current
#

anything that has to do with big persistent worlds

sour river
#

It's just optimization right? Having thousands of synchronized objects and players with low latency?

high current
#

I am sure its much more complex, but yeah

#

Haven't read too much on it, but I think its more like: Having thousands of objects on the server, and cleverly sending stuff the actor needs

summer nova
#

@sour river its about sharding and really big worlds

#

spatial OS is designed for supermassive worlds, deployed in the cloud

#

in a way that the servers automatically balance

#

but ill comment one thing. you do NOT need spatial OS

#

even if making an mmo

#

unreal can handle 100 people in one server just fine

#

200 people if you try hard enough, with super lightweight players

#

and if you do some truly tryhardness, you can write the server yourself

#

and handle several thousand players in one server

#

world of warcraft handled 2000-3000 people with one server

#

in 2005

#

with 2005 tech

#

pirate server Elysium (world of warcraft) could hit 7000 people in a single machine

#

and thats a pirate server with crappy code

jade gazelle
#

It seems like they are trying to implement more and more clever ways to maximize player count as well

#

e.g. the Replication Graph

summer nova
#

yeah, but the thing is that unreal internals for replication are really not that optimized

#

too oop, not very multithreaded, and poor memory management

#

we run into this issues in PUBG

#

@jade gazelle replication graph is great for an mmo, but just running the game logic will trash cpu real hard on a servre in unreal

dark edge
#

How does PUBG do its bullets?

#

Is a bullet just a linetrace that increments in space by velocity/timestep each frame?

summer nova
#

yup

#

bit more advanced, but yes

#

thats how essentially every single game does it

fleet raven
#

I wonder why the default projectile movement uses the component move with sweep thing when that is the most expensive possible way to do a projectile

dark edge
#

@fleet raven my thoughts too. You'd think thered be a line trace option or something.

spring swift
#

holy hell im going to die soon lol

high current
#

Isn't a sweep more multi-directional so to speak, and therefore that is the reason why?

spring swift
#

ok so ive managed to get the spawning system up and running using the player postlogin i think its called. but my problem now is the character selector. ive moved the selector back to the main menu and you select there, and when you join it spawns the pawn and make you take control of the class u selected, at least thats what i want it to do, right now when you spawn u spawn as the server's pawn class and not the one u selected

#

sorry for the long question

#

wait, better question, is there a way to access a certain players instance from the server???\

high current
#

is this spawn thing in a different level?

spring swift
#

no

#

all on the same level

#

so i have the data in the players instance on what class they have selected

#

but right now the gamemode is spawing and possesing the players for them, and using the servers selected class aswell

high current
#

I might be mistacen, but the GM should have an ovveridable function called Get Default Pawn for Controller

#

or something simmilar

spring swift
#

oh i think its called get default pawn class and controller?

high current
#

can you check, I dont have my editor in front of me

spring swift
#

yeah i did, we were both wrong just worded diffrently

#

only uses class sadly, it wont let you get the boolean set inside the instance

high current
#

can you SS?

spring swift
#

SS?

high current
#

screenshot

spring swift
#

oh sorry

high current
#

it should be a function with a class as the return

#

just wanna make sure

spring swift
high current
#

oh, I am talking about and overridable function

#

u know what that is?

spring swift
#

i would asume no lol

#

i think ive messed with somthing with that name once

#

google search has failed vus far

high current
#

on the left side of your editor, where you have your variables and functions

spring swift
#

yes?

high current
#

on top of the functions area, you have the option to override inherited functions

#

its a dropdown

spring swift
#

ohhhhh i see

high current
#

and is there something like what we mentioned

spring swift
#

yeah that one

high current
#

perfect

#

so this is where you would have your class selection thing

#

this gets called so it knows what to put in the player start

#

This however isnt going to help you if the pawn is already spawned

#

if the client has already spawned a pawn I mean

#

which you cant not do

#

afaik

#

hence why yesterday I said that I would have a dummy pawn by default

spring swift
#

i did mess with that and what u suggested

high current
#

this function you just found out is mainly used for new map inits and respawns

#

its used for lots of things but in your case that how it might help you

spring swift
#

but i ran into the problem when the client couldn't communicate with the GM and it completely stopped the whole thing, so i added some stuff to the GS and that failed and then it went burning in flasmes

#

but i did learn how they communicate lol

#

ok so i think i know how i can do this now

high current
#

there is a big caveat here tho

#

GM,GS, and everything except the game instance get flushed(cleared/reset) when you load a new map

spring swift
#

yeah

#

i do know that, hence why the player pawn data in is my instance XD

high current
#

hence you should save chosen classes in per player machine ID in the instance

#

yeah

#

as for stuff in the same map once already spawned

spring swift
#

i literally just use booleans as data lol

#

only important ones anyways

high current
#

u use GS to spawn the new pawn in the player start you need, then poses it(whilst saving that exact pawn/class data) so that upon respawns or new map travels

#

the same pawn is spawned by default

spring swift
#

this is how it work atm bit its VERY messy

#

i cant read it whoops

high current
#

me neither 😄

spring swift
#

lol i think i have it! give me a few more min

#

i decided to make my own function

high current
#

so you are cycling trough bools

#

using enums and Switch nodes is neater imo

spring swift
#

i know

#

im just doing it the way i understand

high current
#

fair

spring swift
#

hmm

#

ok ill explain how badly im doing this

#

i have some bools in my instance that are set to true of false depending on what class u select

#

now

#

the gamemode for the players has a tick even that plays and has the same bools in there and they are pretty much clones of the one in the instance. and these bools are then taken to that function in the GM and they are checked there to see what character u are

high current
#

hmm why on tick tho

spring swift
#

but right now it seems to be making the players spectators which is my fail safe when no class is possible

#

idk

#

lol

#

i did try begin play but it only updated once

#

or maybe is isnt?

#

wait it should work with begin play because u said they reset when a level is loaded

high current
#

^

#

anyway what is the current issue you are facing

spring swift
#

its the same one i think, the players are all spawning as the same class but from a diffrent cause

#

from what i can tell it isnt me messing up the bools

#

just ran a test and it will only spawn as 1 class and not change like it used to so ive done goofed

#

does that look alright to you?

high current
#

yes, but it is kida useless

spring swift
#

lol i know

high current
#

you can cycle which one is true and just output that

spring swift
#

i think anyways

high current
#

how are you transfering the data from GI to GM?

spring swift
#

it goes from GI to the GC to the GM

#

i feel it has to do somthing with that transfer

#

do you think there might be a easier way??

high current
#

the GI isnt replicated

#

when you are setting the data to the GI, are you running the event on server?

spring swift
#

no im running it from a widget which is from the client

#

but technically your not on a server then so you are i guess?

high current
#

well so

spring swift
#

lol am i screwed XD

high current
#

your issue is that the GM currently receives false on everything

#

because you are writing to your client's GI

#

and GM can only read what is on the Server's GI

#

you should move this to your PC

#

and from the widget

#

cast to the PC and run the event on server

spring swift
#

PC?

#

sorry im not too used to all the shorten terms XD

high current
#

player controller

spring swift
#

oh lol

#

ok but wont it loose those values when the game switches to the next level???

high current
#

well if you copy the exact code over to the PC

#

it shouldnt

#

as you are just doing the thing from your PC instead of the widget

#

but you are still casting to the GI

spring swift
#

so it will set those values from the widget to the PC

high current
#

the widget will just thell the PC, hey run this event so that that variable is set to true on the GI

spring swift
#

ok

#

ok so now i have the wigdet telling the PC to tell the GI what class it is, and when the player spawn the GI tells the PC and then tells the GM what class it is?

#

lol i just realised a mistake

high current
#

well, the PC should only tell the GI the class upon selection afterwards, its the reverse, and remember that GM will always be initiated before the PC

spring swift
#

ok

#

ill just make a custom event that activates to update the bools in the PC

high current
#

well yeah, how else would you do it 😄

#

also

spring swift
#

ooo yum

high current
#

This will help you alot when it comes to which/where/how/when/in what order

spring swift
#

ok

high current
#

gl tho, gotta sleep, somehow its 4 in the morning, AGAIN...

spring swift
#

lol

#

sorry

#

have a good sleeo

#

sleep*

twin juniper
#

is it cheaper to replicate AActor* var or FRotator var ?

#

what actually gets sent for replicated pointer variables ? some magic id that the client will use to find that replicated actor ???? 🤔

grand kestrel
#

@twin juniper Basically, its a uint32

#

GUID

#

(Actually I think its an int32)

flint rose
#

Aww, I wish MrTapa didn't go to bed. 😦 I wanted to show him my mad scientist solution from the problem we were discussing yesterday. 😦

high current
#

Welp, he be awake now 😃

#

@flint rose

#

FRotator var should always be cheaper no?

#

its all a bunch of 1 and 0 s anyway

#

(╯°□°)╯︵ ┻━┻

willow fox
#

hey guys i packaged my game and portforwarded my computer but i still can't get someone outside of my network to connect to my game, i can connect just fine with localhost but none of my friends can

#

basically this issue

thin stratus
#

@high current @twin juniper If it's only about the AActor* var vs FRotator and not about all the additional stuff an Actor might replicate on their own, then I would say the actor is cheaper.

#

Cause the Rotator has 3 floats, which is 4 bytes each and the Actor is the already said int32 value that should also be 4 bytes, so 4 vs 12 bytes

#

However comparing that is kinda weird, as I don't see a point at which this would matter (Rotator vs Actor)

high current
#

welp, clearly I need to update my byte math, thanks for the clarification

thin stratus
#

If you are thinking about Replicating the Actor and getting the Rotation from the RepMovement instead of just replicating the Rotator, then the Rotator would be cheaper

#

Cause the rotation has to replicate anyway, inside of the actor, then you would be at already 4 floats + all the crap the actor might replicate

high current
#

And if you just replicate the Actor GUID that wont help as you still need to get the updated value of the rotator

#

I dont even know if you can replicate just the GUID and then search for it locally, that sounds like a waste

#

@willow fox what is your NAT type, I have been able to get public connection as a listen host to work on some routers with a simple port forward, and on other (older ones) I had to set the hosting PC to be the DMZ host

glad sedge
#

How do delegates and multi work - is it based on where the delegate is bound?

#

I.e. if the delegate is bound on the server, it'll fire on the server?

brittle karma
#

is it possible that server side spawns something like a bomb and client side cant see it? cuz basically when server(assume server side is a player computer) do a job all clients should see the result, is it correct?

high current
#

Depends on where you are spawning it from

#

if you are spawning from game mode, it will never be visible to other clients as game mode doesn't physically exist for them

#

If you spawn it with like the game state, then both server and client will see it

brittle karma
#

i have a Car that can shoot and put bombs. when i shoot it works fine for both sides, but when i put bombs server can see the client spawned a bomb(client can see it too), but when server spawns the bomb only server itself can see it. FYI i have a projectile and bomb class that both spawns in the Car.cpp and its surprising that projectile works fine but bomb doesnt, and its getting exiting when client cant see the servers actions. it would be reasonable if the opposite happens

#

@high current it was helpful information thanks.

high current
#

well you would want to multicast this to the relevant actors. What I like doing is using RepNotifys, like a boolean, every time the bool gets changed, the RepNotify function will execute and that is where I would put my spawning actor logic

brittle karma
#

👌

thin stratus
#

The Class you are in has 0 to do with who sees the spawned actor @high current @brittle karma

#

You can spawn in GameMode and GameState. It's more important that you spawn replicated Actors only on the Server.

#

But the class, as long as it exists on the Server, really doesn't matter

#

If the Server can see an Actor but the Client can't, then you most liekyl didn't mark it replicated

brittle karma
#

@thin stratus i set the flags true{ SetReplicates(true) } for the Bomb class and yes they exist on the server. but why client cant see the server's action? shouldnt client see all the actions and updates from server?

thin stratus
#

What is an "Action"?

brittle karma
#

spawning bombs

thin stratus
#

Yeah it should also happen on the Client

#

As long as you aren't doing anything that would prevent that

#

You should also maybe check if the Bomb even exists on the Client

#

Maybe it does and you can't see it

#

Or it exploded right when spawned or so

brittle karma
#

so it means there is something wrong with the code i wrote, thanks.

high current
#

Wait, spawning from GM replicates to clients in UE

#

I avoid doing it since it didn't in UT

thin stratus
#

Yeah it does

#

No reason why it wouldn't

high current
#

And what if the spawned actor doesnt replicate

thin stratus
#

Then it won't replicate to the Client no matter where you spawn it

high current
#

Aight I see, so the net driver spawns the actor for clients, and not the action itself from GM (as that never happens on clients). Yeah makes sense, I have dealth with non-replicated actors mostly, thats where the confusion comes from

#

I'll tone down helping in #multiplayer as it seems I have a few wrong practices...

wise depot
#

Is anyone around who's worked with steam dedicated servers?

thin stratus
#

@high current Don't worry, just make sure you double check what you tell people

#

I don't know everything either

#

@wise depot Lots of people I guess, but the ones that have took a lot of damage from it and don't want to deal with it again ;<

wise depot
#

yeah i did it about a year ago when our project was on 4.18 and it was working fine

#

now we're on 4.22.3 and its all fucked again

#

steam server with unreal is a nightmare tbh

#

4.14* rather

high current
#

4.14 to 4.22 jump must be a nightmare all around

thin stratus
#

I once updated like 11 or so versions and it all worked

#

Still not trusting it

#

(minus the obviously deprecated functions)

high current
#

I have done the backwards

#

4.22 to 4.15

#

Wont recommend

thin stratus
#

You can't downgrade o.o

high current
#

You can if you copy paste everything manually

thin stratus
#

Uff

high current
#

And when the copy paste itself crashes the editor, its fun

glad sedge
#

oh god

#

Just santiy checking - NetMultiCast means calling a function on both Server + Client, yeah?

winged badger
#

if you're calling it from server, yes

glad sedge
#

Yeah, only from server.

#

Okay cool - just some late night sanity checks.

#

Hmm anyone test dedicated server from the one comp, and have your input actions take over from each other?

winged badger
#

seems like someone's been using GetPlayerController[0] on dedi again

high current
#

Hmm

glad sedge
#

hmm maaaaaaybe, but I don't think so

high current
#

Is that a feature you want or a bug

glad sedge
#

Though I do think I'm setting one pawn to two PCs. heh

#

(player controllers.)

#

Which would explain it.

fleet raven
#

why is USceneComponent::AttachChildren replicated ...?

#

would it not be far more sensible for the AttachParent of components to replicate?

#

then they could attach themselves

winged badger
#

with in PIE testing

#

the awkwardness with windows might had ninjaed your focus tho

#

to make my life more interesting 😦

glad sedge
#

yeah.

fleet raven
#

the current way prints errors when you attach non-replicated components and makes my component that changes its attachment itself cause ensures

winged badger
#

the FNetGUIDCache object not supported?

fleet raven
#

yep

winged badger
#

can you ensure same name on clients and server?

#

for those components

fleet raven
#

though that is not actually the current problem, it's just one I noticed in the past

winged badger
#

if so, SetNetAddressable() on the component will solve your issue

high current
#

When dealing with MP, always get the controller from its relevance to the actor you are tinkering with @glad sedge

grizzled bay
#

any one know how to stop an actor spawned by the server player from showing to all clients, when the clients spawn the actor only they can see it, but with the server player i can't seem to stop it from showing

fleet raven
winged badger
#

if you get a name mismatch after you SetNetAddressable() you'll get a NetGUID mismatch

#

which will disconnect the client

glad sedge
#

@high current Can you expand on that a bit?

#

Not sure what you mean

high current
#

@grizzled bay is your actor replicated

fleet raven
#

like I don't want its attachment to be set by replication ever

#

only my OnRep should change it

glad sedge
#

as in get the PlayerController locally from the actor I'm controlling ?

high current
#

@glad sedge for example if you are dealing with a pawn, you can get the controller of the pawn, instead of just spamming GetPlayerController [0]

grizzled bay
#

the actor is spawned in the player controller and has replication turn off, but i have also tried using replication and also using set only owner see on the actor which is misbehaving @high current

high current
#

if you dont need to replicate the actor itself then dont, and you can spawn your actor using the Switch Has AuthorityNode

grizzled bay
#

been going in circles for while trying to stop it showing on clients, but even if i stop the server from seeing it, clients still can, has been a pain

glad sedge
#

yeah I don't get the playercontroller that way

high current
#

And you are still facing the issue where the input can be hijacked from another client(window)?

glad sedge
#

I'll tell you in 2 seconds

winged badger
#

@fleet raven the AttachParent has to be replicated as well for that children replication to work

glad sedge
#

Yeah, it's still an issue but I think I know why it's doing it.

fleet raven
#

the thing is I want to manage the attachment myself all of the time, replication should never mess with it

#

since I need to save off the previous transform and start interpolating when it changes

winged badger
#

you could probably workaround it in PostNetReceive but it would be ugly

glad sedge
#

Anyway, all g for now

#

Night all

high current
#

night

fleet raven
#

actually

#

the component being attached is not even replicated at all

#

so wtf 🤔

#

now I'm confused how it's hitting the ensure

winged badger
#

i had locally spawned meshes attached to a replicated skeletal mesh

#

and on occasion, during root montages, skeletal mesh would suddenly decide to replicate its attachements

#

on clients, every attached mesh would just fall off

fleet raven
winged badger
#

is it registered?

fleet raven
#

yeah definitely

winged badger
#

shrug that would trigger it

fleet raven
#

it runs after beginplay

#

mfw reading code I wrote a year ago and have no idea what I was doing

high current
#

Hey, If i read my stuff from last Thursday idk whats going on... So, a year aint bad

grizzled bay
#

anyway i solved my earlier issue. I guess the actor being spawned by the host player just always made the actor it spawned replicate, so turning that off on the new actor seemed to work, still other issues, but least one hurdle down

chrome bay
#

You need to uncheck 'bReplicates' in the blueprint of the object you're spawning

#

I.e. whatever is plugged in to 'Class'

grizzled bay
#

good to know why it was doing it, changing that in the class kind of ruins the rest of the building system though, but thanks for letting me know

#

my current issue is working out why set static mesh returns true and works fine when the client executes it from server, but returns false if the server player executes it

chrome bay
#

np's, I don't know the system of course - but what i can say is spawning the actor as replicated then marking it to not be replicated probably still creates the actor channel, which is a bit of a waste. If you can avoid it somehow it's probably best to. You get a bit more control over that in C++ but.. yolo

high current
#

Perhaps if you invert your logic, mark isReplicated as false by default, create a bool like shouldReplicate or so, expose that on spawn and set its default to true, link it with the inReplicates of the SetReplicate node (which also is should be on that begin play).

#

That way you can spare the actor from creating its Rep channel when you spawn it like that in your screenshot, and the rest of your system should work

#

Idk if spawning an actor as not replicated, and replicating it on begin play would spawn it for everyone else tho

grizzled bay
#

okay, i used what you said, to do it that way i would change it to replicates only at the time it is actually built

#

that should keep everything working the same

#

yeah it does

high current
#

🎊

grizzled bay
#

thanks

jade gazelle
#

If I wanted to include a handful of classes only with Server builds, is it simply a matter of creating a separate module and adding something like this to my project build file?

#

and then making sure to wrap all usage with the server preprocessor in my main classes?

chrome bay
#

I guess it should work, so long as you don't have BP's or any serialized assets based on or referencing those classes

#

I guess best way is to just try compiling and see what happens

#

But yeah with that setup that module won't be included unless it's a server build

jade gazelle
#

It's mainly for AI stuff that is all calculated on the server, none of its ever replicated or exposed to the client so I figured it makes sense to just exclude it entirely from client builds

#

I know the default UE workflow is kind of just include everything for both client and server and then filter use by role, netmode, etc.

#

but i kind of want to hide some stuff from the client

#

entirely

chrome bay
#

Should be fine, but if you have any assets or BP's referencing that stuff they'll just break

#

It'll should be obvious when you try to build it though, as it won't package or cook

jade gazelle
#

I guess that's probably the best way to find out, haha

#

Will test is out later when I get home

chrome bay
#

Yeah for sure, hard to speculate really 😄 Like if you had a pawn that referenced a default AI controller for example, and that AI controller doesn't exist in the client build, the build will fail.

jade gazelle
#

thats what I was just thinking about

#

because while the AI controller would ever be on the server, the NPC that uses that controller is on both

#

and is replicated obviously

chrome bay
#

Even if the controller isn't used, if there's a BP of it, or the gamemode has a reference to it etc, client won't package

#

Even if it does somehow package you might get mismatched checksums for assets and not be able to connect etc.

jade gazelle
#

well the CPP references I think would all have to be wrapped with the WITH_SERVER_CODE preproc

#

in order to compile client builds without error

#

not sure how BPs would be handled though

chrome bay
#

What I mean is assets won't care about pre processor stuff

#

If any asset exists in the project that references 'AIController' and you try to package without that CPP class, it'll fail to cook assets

jade gazelle
#

I'll have to test it out, right now I'm just filtering everything block by block with the preprocessors which works fine, but is tedious

#

was thinking it would be easier to just have entire classes allocated to server only

#

but maybe that causes its own problems like youre saying

chrome bay
#

Yeah, it seems like more trouble than it's worth tbh

#

the term premature optimization comes to mind 😄

#

but I'm always guilty of that so yolo

jade gazelle
#

hah. well it's not really about optimization so much as just maintaining a clear defining line between the server and the client, and only exposing to the client the bare minimum information they need

brittle karma
#

where is the best place to implement health system so it can be replicated on clients? (Game Mode, Game Instance. player class itself?)

chrome bay
#

on whatever actor takes damage I would guess

#

data locality isn't really much different in MP to SP

high current
#

@brittle karma I would say Player State/Pawn combo, but that is just me

chrome bay
#

pawn for me

high current
#

I find it easier with player states when I have to do UI stuff for example to display health for others

brittle karma
#

aha, thanks @chrome bay @high current

chrome bay
#

Depends on the game I guess, but you lose a lot of flexibility and the like putting it there

high current
#

The way I do it is by having the health logic inside the pawn, and player state is just always updated with the newest health info of its pawn

maiden vine
#

What's a simple way to allow only one players pawn through a collision of a mesh and block the others...Im blank lol

chrome bay
#

Use MoveIgnoreActors

maiden vine
#

Thx for that happy gaming

thin stratus
#

Still not sure how to get the Camera Location on Simulated Clients

#

Need this to simulate weapon fire

#

Close to just making a replicated FVector ..

bitter oriole
#

@thin stratus Pretty sure that's the only way

#

I mean the camera doesn't even exist remotely

#

Except on your own PlayCont obviously

thin stratus
#

The Component itself exists

#

But yeah I repl the location now manually

#

I'm doing enough optimized things to allow that

bitter oriole
#

The component exists for a remote, non-local-player player controller on a client ?

#

Oh yeah of course it does

#

Since it's on the pawn

#

But it's very likely not updated accurately

summer nova
#

update on the struct hack

#

it works

#

it actually works

#

with it i can actually implement a fairly good ECS system in unreal that does support editor and replication

high current
#

🎊

steady briar
#

so is it true theres no effective way to adjust a characters movement speed in bp for multiplayer?

#

found a vid that does it in C++ because the bp one has a lot of network issues

flint rose
#

@high current , I figured out my issue with anim notifies if you're interested lol

high current
#

sure

#

@steady briar hmmmmmmmm 🤔

#

if your character us properly replicated, the movement speed is just a value which should change on all clients

flint rose
#

I extracted all the notification times for each animation in a montage, and created timers when the montage is played on the server to enable/disable the weapon collision. It's ugly, but it works

steady briar
#

@high current i think its a prediction problem in the movement component or something, i dunno i skimmed a vid and found examples of how to see that it doesnt actually work and the only fix in c++. something to do with... int... 8bit... something i dunno im really dumb <_<

high current
#

sounds ridiculous but crazier things have happened so lets wait for someone else to confirm or deny this

#

maybe post the video as well

steady briar
#

ok just saying im not trying to make an mmo, ive ignored this guys vids for a long time until i was like... meh i got nothing else to do (seems to be some good stuff) but ya heres the 2 im talking about

high current
#

@flint rose haha, yeah if it works it works... I would have used a timeline, and just launched the events on the specific time tho

flint rose
#

Sorry for my nubness, what is a timeline?

#

Ah, I see.

#

Just looked it up

#

Well, it works, if I need something more complicated I'll switch it over.

steady briar
#

basically a timeline is curves that can update multiple values as they go. just Add Timeline and double click it, add some values and u should see new outputs

high current
#

Yeah, I suggested it because its easier to set up, functions entirely the same for your intent

flint rose
#

My only problem now is it seems my weapon is only colliding with other characters weapons

#

Hmm, actually it may be network related.

#

When I don't run a dedicated server, the collision appears to be fine

high current
#

@steady briar skimmed the video, the guy just seems to have issues with ping and lag

#

:D, as we all do

#

for a blueprint solution what I would do is that I would lerp the speed change(if needed),and at the same time fiddle with the prediction tolerance of the character movement, based on how much the speed difference is

steady briar
#

well its all above me. setting a bool i can do. anything else...... no idea

high current
#

well in that case, I would say, don't worry about it, that's advanced stuff, make sure your logic works, I don't think this prediction miss match will cause you much problems in your current phase of development

steady briar
#

ok well i can do more than just set a bool but ya once it becomes a deeper issue im not smart enough to fix it myself

#

ill ignore it for now but at least when i do run into that whole situation i have some references

high current
#

Ill look into his C++ method in a bit tho

#

and bash my head at the wall cause I dont fully understand C++

steady briar
#

ya i can follow blueprint that i dont understand myself yet. like i get the general idea. i couldnt get it to print Hello World in C++

grizzled bay
#

so i am working on making my building system work with multiplayer. I am using a class containing multiple meshes, this gets spawned by the server using spawn actor, that actor is set to replicate after it is spawned, and then has it's static mesh changed to the correct mesh (the static mesh also has replication enabled)

The problem however is that even though it is meant to replicate, clients are unable to see anything except the default mesh unless they are the ones who told the server to spawn it. this means that the server sees all changed by itself and other clients fine, clients can't see non default actors from the server or other clients, so if the server places a ramp, they can run up it or collide with it but only see it as a floor

I have tried all kinds of different ways of replication, the closest i got was calling the set static mesh on each client using multi cast after the actor has been spawned, but that results in a noticeable period of time when the client can see a floor before it changes. not sure if anyone has any ideas, but any help would be appreciated

high current
#

Sounds like your event for change the mesh isnt multicast-ed

#

have you tried using a rep notify (OnRep)

#

to change the SM, instead of replicating the actual SM

grizzled bay
#

yeah it spawns as a ghost per player first, so may have somthing to do with that, seems like it may be trying to use it's own build or somthing

#

the change itself was only happening on server or multi cast

high current
#

also I am assuming that you have tried setting the SM to be replicatable and just running the change mesh event on the server?

#

and CPP or BP based?

grizzled bay
#

blueprint

#

i have tried it many ways the default way is running the set SM on the server sustom event when the actor is created, but i have also made that call a seperate multi cast event, checking for authority all all that

#

it is possible the clients ghost is interfering some how so i guess that is my next step

night jay
#

Anyone had any luck with Epic Online Services?

#

I'm trying to implement the ticketing system but I can't POST a request to the http url

flint rose
#

I haven't used it much but I have a bit of experience with HTTP

#

What is the response code you are receiving?

night jay
#

LogHttp: Warning: 00000212AF098180: request failed, libcurl error: 65 (Send failed since rewinding of the data stream failed) This is what I get

flint rose
#

Ah, so it's not sending a request at all

split gust
#

might be you not following redirects correctly