#multiplayer

1 messages ยท Page 500 of 1

thin stratus
#

Most likely

#

I wrote that when i learned that stuff

#

You should place it into the GameSession class

#

And some stuff is simply outdated like the way to get the session interface

grizzled stirrup
#

So create a new cpp class deriving from GameSession and have the GI call it on the GameSession instead of doing it itself?

thin stratus
#

Are you using this in cpp?

grizzled stirrup
#

YEs

thin stratus
#

Yeah then that's fine

#

GameSession class has to be implemented by overriding the GetGameSessionClass function of the GameMode

#

Something like that at least

#

Just so you know

#

G2g sitting at airport

grizzled stirrup
#

Ok thanks!

#

As for getting the session interface: this is no longer the best way? IOnlineSessionPtr SessionInterface = OnlineSub->GetSessionInterface();

#

If you have a chance to reply later

thin stratus
#

Online::GetSessionInterface or so

grizzled stirrup
#

Great thanks! That probably removes the need to have to call IOnlineSubsystem* OnlineSub = IOnlineSubsystem::Get(); every time you want to get the interface

#

Will look at how ShooterGame does things since I believe they have all their session related code in AShooterGameSession

#

I wonder if ShooterGame is up to date in this regard

thin stratus
#

UT and ShooterGame

#

That's probably the most info you can get for free

grizzled stirrup
#

Thanks!

#

I see they are clearing delegates slightly different too : Session->OnFindSessionsComplete().Remove(OnSearchSessionsCompleteDelegateHandle);

Have also seen delegates being cleared this way OnFindSessionsCompleteDelegateHandle.Reset();

#

Assume they do the same thing as how you cleared the delegates in the wiki

#

Will read up those examples and try to see what to update

twin juniper
#

@thin stratus following your advice I realise it has to do with me assuming 'delay' is local to each player in the game mode, whereas it operates globally in the game mode - and when further players spawn when the first has triggered the 'delay' then any logic including and after their 'delay' is ignored - tried it with 4 players and as expected only the server and 1 client spawn

worthy perch
#

Don't entirely know what you meant, but the GameMode only exists on the server.

thin stratus
#

They were delaying the postlogin randomly

#

Delay is always shit in multiplayer

#

At least if it's to fight some intialization lag

worthy perch
#

From what I see, UT and ShootGame both use:

const auto OnlineSub = IOnlineSubsystem::Get();
    if (OnlineSub)
    {
        const auto SessionInterface = OnlineSub->GetSessionInterface();
        if (SessionInterface.IsValid())
hoary lark
#

@waxen quartz I'm not an expert but I think any packet loss over 0.5-1% would be considered a very poor quality connection, I think 30-50% loss usually only happens for very short periods of time when something has gone totally FUBAR on the interwebs

#

(or maybe if you're trying to play on your three-doors-down neighbor's unlocked wifi)

waxen quartz
#

alright good, thanks

fleet raven
#

if your game works fine with 50% packet loss it'll do well in any realistic conditions br_thinking

rotund sapphire
#

If your game works nicely with 50% packet loss, it is a single player game obviously. :)

waxen quartz
#

LOL yeah it doesn't work nicely it just doesn't go to shit

grizzled stirrup
#

Is there an equivalent to this BP event in c++?

    /** Opportunity for blueprints to handle network errors. */
    UFUNCTION(BlueprintImplementableEvent, meta=(DisplayName = "NetworkError"))
    void HandleNetworkError(ENetworkFailure::Type FailureType, bool bIsServer);
#

Seems it is called directly from UnrealEngine.cpp and can be a nice way to react to network errors

#

However since it's BlueprintImplementable and not virtual, I'm not sure how the cpp game instance can react to it

hoary lark
#

@grizzled stirrup "The engine does perform a heartbeat internally, and clients will be notified when a timeout occurs through the UEngine::OnNetworkFailure() event. If you'd like, you can add your own handler for this event, or you can subclass UGameEngine and override the HandleNetworkFailure function. See ShooterEngine.h and ShooterEngine.cpp in the ShooterGame sample project for an example of overriding HandleNetworkFailure." https://forums.unrealengine.com/development-discussion/c-gameplay-programming/21485-where-how-do-clients-know-when-the-host-has-crashed

#

seems weird they wouldn't just make the gameinstance one C++ virtual too but oh well

silver lotus
#

Anyone know if theres a way to determine if all players have loaded the map from Blueprint?

winged badger
#

NumTravellingPlayers == 0 in GameMode

#

i am assuming you're asking for after seamless travel

silver lotus
#

Yeah

winged badger
#

number will change during HandleSeamlessTravelPlayer

silver lotus
#

That's a blueprint overridable event I assume?

winged badger
#

either that or BlueprintImplementable

silver lotus
#

๐Ÿ˜„

#

Awesome, I'll give that a go in my lunch break. Thanks Zlo!

#

One more quickie, is there a way to do a ServerTravel in Blueprint besides exec console command, because that does not work in PIE at all.

winged badger
#

nope

silver lotus
#

Damn

winged badger
#

its not, but it will call HandleStartingNewPlayer

#

which is

silver lotus
#

What is? The HandleSeamlessTravel?

winged badger
#

HandleSeamlessTravelPlayer isn't BP exposed, but it calls HandleStartingNewPlayer, which is blueprint overridable

silver lotus
#

Ah

#

No worries then, I should be able to handle that then

#

Do I still get access to NumTravellingPlayers ?

winged badger
#

yeah, thats just an integer in gamemode

silver lotus
#

๐Ÿ˜„ Awesome.

#

Thanks mate!

grizzled stirrup
#

@hoary lark Thank you very much yeah it's a very strange choice indeed

winged badger
#

the parent function of HandleStartingNewPlayer (parent from BP pespective) just calls RestartPlayer

silver lotus
#

๐Ÿค”

winged badger
#
void AGameModeBase::HandleStartingNewPlayer_Implementation(APlayerController* NewPlayer)
{
    // If players should start as spectators, leave them in the spectator state
    if (!bStartPlayersAsSpectators && !MustSpectate(NewPlayer) && PlayerCanRestart(NewPlayer))
    {
        // Otherwise spawn their pawn immediately
        RestartPlayer(NewPlayer);
    }
}
#

its just that, so you don't have to call the parent

silver lotus
#

Ah

#

I mean there's no real harm in calling the parent

#

Thanks for that Zlo ๐Ÿ™‚

winged badger
#

@grizzled stirrup i got distracted the other day, did you manage those STEAM_CALLBACKs?

grizzled stirrup
#

Yes just about thanks! Seems to be working great, though the only weird gotcha I've noticed is that I have to bind the delegate handles in Init rather than in the constructor for valid sessions to be sent through on the invite / join in progress callbacks

winged badger
#

occured to ma later that with a question that specific you can just do a discord search for "STEAM_CALLBACK"

grizzled stirrup
#

Yep I was all over every search I could find

#

Managed to find someone's semi related question and cobble it together

#

Very very little info on them in general though

winged badger
#

and that stuff in steamapi.h is downright unreadable

grizzled stirrup
#

It's a madhouse

winged badger
#

macro defined over macro defined over macro

grizzled stirrup
#

Especially for someone new to C++ like me

winged badger
#

its worse then AIPerception

#

(no macros but shitton of typedefs)

grizzled stirrup
#

๐Ÿ˜„ Haven't had a chance to see the code there!

#

I'm honestly extremely surprised that there wasn't a single example of setting up the callbacks anywhere online, seems like a very common thing you'd be doing with steam (reacting to events from their interface )

#

Soooo many BP advanced sessions tutorials though all doing the same create / join ๐Ÿ˜„

winged badger
#

i use uworks for that, so haven't had many encounters with raw steam API

grizzled stirrup
#

Probably best to avoid it if possible

#

Luckily it's a one time communication setup and I shouldn't have to go back and touch the callbacks once they are working

#

Question: it seems when clients lose connection to a game or the host shuts down the server, they are unable to create new session OR find new sessions and are in a state of limbo unless they relaunch the game. Should you be destroying the session manually for any clients in any case where they are leaving a match?

#

There's this code from the ben tristem multiplayer course that destroys before creating a new one but I feel it's sketchy at best

#
    {
        auto ExistingSession = SessionInterface->GetNamedSession(SESSION_NAME);
        if (ExistingSession != nullptr) 
        {
            SessionInterface->DestroySession(SESSION_NAME);
        }
        else
        {
            CreateSession();
        }
    }
winged badger
#

i wired that into MainMenu

grizzled stirrup
#

So you destroy whenever MainMenu is shown?

winged badger
#

yeah, its its own level

grizzled stirrup
#

Using a similar line to the ExistingSession one there?

winged badger
#

so it just tells the GI to destroy a session and show main menu on BeginPlay

#

only acceptable use of level BP imo

grizzled stirrup
#

Nice!! Yeah that and showing loading screens ๐Ÿ˜„

#

I have a MainMenuPC so I can do it there

#

I assume SessionInterface->GetNamedSession(SESSION_NAME); will return the clients local version of the session?

#

What confuses me is that I read earlier that the session only exists on the server

#

So I am not sure why the client has to destroy it

winged badger
#

not sure about that

#

its over 2 years since i last touched the session API

grizzled stirrup
#

There is conflicting info in the docs: they say you have to call DestroySession() on the client in the BP API docs but say that the GameSession is server only on the general OnlineSession docs

winged badger
#

if you destroy a session that isn't there

#

you'll get a warning in output log

#

shrugs

#

nothing else

grizzled stirrup
#

Funny that destroying the session in the client does take them out of that limbo state and they can host / join again

#

So may as well do it

#

Thanks!

silver lotus
#

@winged badger doesn't appear to let me access that variable

#

๐Ÿค”

#

Time to reparent

#

Ignore me - it works now !

shy apex
#

hey

#

how do i make a line trace not replicated

#

even running an event from the client keeps it replicated somehow

#

and when the client has high ping, the locations are different and inaccurate

#

btw im using this to detect if the pawn is on the ground

#

i fire this event every 0.1 seconds

worthy perch
#

Line traces aren't replicated. You're probably calling some RPC or accidentally calling it from other places.

shy apex
#

idk

#

maybe the location is different because the capsule is replicated?

#

as soon as the client has high ping, the line trace is delayed

gleaming kestrel
#

Anyone know what 'Uses Stats' actually does in 'create advanced sessions' (of the advanced sessions plugin)? I guess it uses some kind of statistics? That I can inspect?

somber glade
#

Having a small issue with with a 3D widget in VR. I know widgets and their contents aren't replicated. The host of the game confirms the start and clicks start (they have an option to check a box if there aren't enough players to start anyway). On clicking start it calls to the gamemode and sets everything in motion for beginning the match. This works totally fine. Everyone gets placed on the map and set up perfectly well. I just added this new thing which doesn't work and I'm not sure why. When the match starts, I want my lobby widget to display a "briefing" image. This image is there, but "collapsed" by default. It checks its visibility status with a variable on the instance. As far as I know, the clients can connect to the game instance right? When the match is started, the game mode kicks off it's countdown timer and then also casts to the game instance and sets that variable. However, the report from testing that I got was that the clients couldn't see this image. Only the host.

#

Yes, the variable is replicated.

dark edge
#

GameInstance is for each time the program is run and is persistant

#

@somber glade You wanna use GameState i think.

somber glade
#

ahh dammit thanks

dark edge
#

@somber glade It already has all the match related stuff, don't gotta make your own

somber glade
#

Yeah, I just had them mixed up ๐Ÿ™‚ Thanks for refreshing my memory

#

and that instantly fixes it

grizzled stirrup
#

Seems to have a good few examples of how to set up the callbacks

#

Does anyone know why most of the examples I have seen with Steam callbacks use STEAM_CALLBACK_MANUAL instead of just STEAM_CALLBACK which doesn't require you having to register the callback manually?

#

I am using STEAM_CALLBACK and at least for the join in progress /lobby invite callback it works fine

grizzled stirrup
#

Is it possibly only for Blueprint reasons since delegates of this type OnFindFriendSessionCompleteDelegate = FOnFindFriendSessionCompleteDelegate::CreateUObject() can't be exposed to BP whereas if doing it manually you can specify a dynamic delegate which can be?

thin stratus
#

Don't think there is much to worry about with _MANUAL or not

#

Whatever works for you

#

For exposing session stuff to BPs you should use the Proxy class to create latent nodes

grizzled stirrup
#

Great thanks! I don't need to expose to BP fortunately, just was curious about the choice for MANUAL

#

I see why creating your own GameSession class is so important now btw

#

Especially for cases when the GM calls HandleMatchHasStarted which starts the session in AGameMode

#

It's nice to be able to call the HandleMatchHasStarted super call a bit later in the GameSession to be able to update session settings before it begins like allowing join in progress

thin stratus
#

Funnily, the CreateSession node starts the session directly

grizzled stirrup
#

Ohhh maybe that's why Steam doesn't allow the session to be discovered after the first player joins (when the join in progress bool is false)

#

And I've had to allow join in progress until the game has actually started

#

Based on your tutorial setup I had called GI->StartSession() when the game was actually ready to start but I see it is already called in AGameMode::HandleMatchHasStarted and possibly again via CreateSession as just mentioned

#

I guess the solution is NOT to call GI->StartSession() anywhere in my game code and let the session get started through the AGameMode call. Then make a custom AGameSession class, override HandleMatchHasStarted, don't call super and set join in progress to false before manually starting the session there

#

It seems ShooterGame doesn't call super either there which means this never gets called:

            if (PlayerController && !PlayerController->IsLocalController())
            {
                PlayerController->ClientStartOnlineSession();
            }
#

Is that an important thing to call?

#

Hmm that seems to start the session for each client locally via a client RPC: GetGameInstance()->GetOnlineSession()->StartOnlineSession(PlayerState->SessionName); so confusing since the docs say the session only exists on the server...

thin stratus
#

The Session should also exist on clients

#

Sessions are only information after all

#

Backend keeps track of that and who is part of it

grizzled stirrup
#

Cool thanks so you'd say that PlayerController->ClientStartOnlineSession(); should indeed be called, and as a safeguard any existing sessions should be destroyed before creating a new session on the client?

#

Have noticed that if not leaving cleanly through the quit button (and manually calling DestroySession) or if there's a sudden loss of connection, the client doesn't have a chance to destroy his local session which means he can't create or find new sessions. Zlo had a good solution of destroying any existing client session when opening the main menu

gritty pelican
#

Advise hosting for Europe, for a dedicated server

rose tartan
#

Hello Everyone,
Does anyone know how to check if my PC is connected to a proper internet connection or not?

bitter oriole
#

Or is this for your game ?

vivid fjord
#

open cmd, type in ipconfig

cedar finch
#

Is the correct way to replicate impulse to run the impulse on server, then send the hit actors world transform on multicast?

cedar finch
#

Also I'm having a strange issue where "walking" is jittery and laggy for clients but if they "crouch" or "sprint" it stops. But as soon as they start walking again it starts jittering and lagging. What causes this?

jolly siren
#

Are you sure the player's speed is the same on the client and server?

grizzled stirrup
#

Should all steam callback code be wrapped with the async thread wrapper like so?

        AsyncTask(ENamedThreads::GameThread,
            [this]() { OnLobbyCreated(CurrentLobbyID); });
#

I often see it being done, in my case it isn't crashing without it but just calling the function 3 times even though it's only been triggered once (one join / invite accepted)

winged badger
#

if the exec ends up in BP, it will crash frequently if you don't

#

otherwise, it might still crash

grizzled stirrup
#

Many thanks!

#

Will wrap it

cedar finch
#

@jolly siren Yea maybe that's it. IDK I set that variable inside each character when they spawn and it's all the same value. I'll just hard set it inside each character and see if that fixes it.

worthy perch
#

If you're doing this Steam callback stuff, doesn't that tie you down to using Steam?
Would really seem quite limiting of using online subsystem stuff if you have to implement any platform specific logic, but that just may be an unfortunate reality.

grizzled stirrup
#

@worthy perch Everything is set up in a generic way but in the case where you join a friends game or accept an invite via the steam menu, I need the game to react to that

#

So it's an additional steam specific callback

#

All the other stuff uses the generic JoinSession etc.

#

Really the only steam specific part is the callback itself, then it just calls the generic FindFriendSession function

#

So in the case where I was able to port to another platform, the steam callback functions wouldn't be called, and instead there'd be new callback functions for whatever platform that'd call the same generic session functions that the steam callbacks call

cedar finch
#

Where do you store a boolean value that everyone needs to know about called "KeyFound?" ?

worthy perch
#

You probably need to be more specific, particularly what you mean by "everyone needs to know about"

cedar finch
#

So I have a lot of puzzle related things such as finding a key to open locked doors, etc. I want it to replicate where if somebody finds a key, then everyone has it. Basically setting a boolean for everyone. Would that do in gamestate? gamemode?

worthy perch
#

GameState sounds like a good place for it. GameMode is only on the server, so that would be bad.

#

But pretty much any replicated class is capable of replicating to all clients, especially if it is always net relevant.

summer rivet
#

I want to confirm this is the right way to get something to happen on all clients in a MP environment? https://i.imgur.com/KOMvBRD.png it works as expected I just want to make sure the nodes are correct. Local Player Pushes button -> Server Call then Server Call -> multicast call then Multicast call -> do what I want on every client

worthy perch
#

The multicast is probably not neccessary.

#

You probably want to have some replicated bool on the Player instead.

summer rivet
#

any reason why to do that over having each client handle it

worthy perch
#

Multicasts can fail, whereas replicated properties will eventually replicate down.
OnReps are pretty cool.
In my opinion, manually assigning values to the anim instance especially through an interface is just more rough than it needs to be.

summer rivet
#

that last part is where the question of how to handle animations across clients comes in then

severe widget
#

you can set the bool to the correct state on the locally executing client, then it shouldn't get the on rep.

summer rivet
#

right now I have the anim notify in the idle trigger the boolean back to false in the anim graph itself

severe widget
#

that makes it possible to do local prediction

worthy perch
#

The replicated bool would propagate down the client, And the AnimBP through the update or by whatever way you want, would read this bool.

severe widget
#

not particularly fantastic prediction, there's no rewind mechanism intrinsic to that, but multicast is unconditional and so you wouldn't be able to

summer rivet
#

yep its the setting the boolean back to false that would be an issue if I just replicate a boolean in the player

#

player sets bool -> anim graph updates in update -> animation fires then... how do I tell the player that the boolean is false now which would then replicate to everyone for no good reason?

severe widget
#

Hrmm

summer rivet
#

trying to "learn" properly at this point, I can of course just make shit work but doing it efficiently and "proper" is the goal here

severe widget
#

Seems like the replicated bool and the animation book should be separated

worthy perch
#

Well, there are better and more complex ways to do this that I'm not familiar with, so, perhaps I'm a bit out of my depth.

summer rivet
#

yep just taking all input till I get all the angles. There is more than one way to do it so I want to learn the plus/minus of them all of course

severe widget
#

I reckon you could do this with just the one bool

worthy perch
#

However, you coud just multicast which calls some PlayMontage locally.

summer rivet
#

I personally like the idea of the animations driving the actions so I can make sure they are keyed up properly based on animation length and any variables around that

hoary lark
#

use the bool as a trigger and "consume" it back to false

severe widget
#

multicasts can be marked reliable but you really shouldn't

worthy perch
#

And I saw that you mentioned dedicated server, dedicated servers by default, don't play animations on the skeletal meshes.

summer rivet
#

yep just meant dedicated server since I was just firing it on server and it was playing and I got confused (but that was due to it being a listen server so duh...)

#

stupid listen servers always throw up confusion since you scratch your head on why server calls are executing on a client lol

#

so for something like this, an animation, is not having it reliable a big deal?

severe widget
#

because it means ue4 can't drop them if your bandwidth gets saturated

hoary lark
#

if it's a competitive tactical game where it's crucial that you see when your opponent is reloading always, maybe

worthy perch
#

If it fails, you crash. In a sivestream, they said they considered not even allowing Multicasts be marked reliable.

severe widget
#

property replication is batch serialized, but RPCs aren't handled the same

#

!!?

summer rivet
#

the same question applies to simply calling a fire then, client1 fires so how does client2 know client1 fired reliably in terms of damage and animation then. I guess replicating variables reliably is smarter?

severe widget
#

you don't crash if the RPC fails

worthy perch
#

I'm pretty sure you do crash if a reliable RPC fails. But I could be wrong.

severe widget
#

it just constantly retries it

#

if reliable replication crashed on fail, no UE4 multiplayer game would ever ship

summer rivet
#

ooh.. so would a reliable RPC then be when you see a chunk of lag then suddenly all the event fire off?

severe widget
#

unless you mean something else

#

reliable just means TCP emulation (if not usage) occurs.

summer rivet
#

I dont need like "omg lag prediction and rewinding" in terms of my goal here but getting across the basics that seem to block people when learning MP for the first time is my goal. Animation and replicating basics like firing seem to be a super stopper

severe widget
#

Run this event. I ran this event. I see you ran that event.

summer rivet
#

pretty much any replication seems to be an issue when learning lol but shrug

severe widget
#

Working on a tut?

summer rivet
#

thats the plan

severe widget
#

hmu tomorrow after ~5 est

summer rivet
#

nothing fancy just an intro get over the basics. Here is the tpp project, here are the anim starter stuff, lets make 2 people fight and make it look correct.

#

and to pound in the server controls everything aspect of replication lol

#

@severe widget will try and remember, I keep getting sidetracked with real work lately lol ๐Ÿ˜ฆ

severe widget
#

if you still need guidance

summer rivet
#

I was doing the replication aspect of animations earlier btw @worthy perch but stumbled upon the idea of interfaces and anim notifies so was trying it out but glad I asked i completely forgot about stuff not being reliable

#

I like the idea of data driving results, like the animation start/stop. I guess I could always have the notify tell the player the anim has stopped and flip the bool in there lol. to the graph!

#

hmm.. so how can you stop a variable from being replicated if you don't want it to be lol

worthy perch
#

I think just multicasting something that plays a montage would be the most effective/easy.

summer rivet
#

I thought about that as well but can I have the montage use blending so I can lock the hips and below to the current animation and blend in the reload animation like I can in the graph

worthy perch
#

Also, keep in mind, the client can overwrite a replicated property. The server won't know about this, and replicated properties are by default only sent on change.

#

Mathew, I think so. I'm pretty sure all the blending in and out is available in the animgraph with montages.

summer rivet
#

yeah if the local anim notify fires in the local graph and sets the local player variable back to false that would be fine but I would think that act would trigger the replication to other clients if the server does it.. Maybe uh just only do this on clients and not server lol

#

man... so many options

#

I like the options, giving people all the plus/minus of stuff is good imo

#

welp back to the graph then to try all of this out ๐Ÿ™‚

#

oh one last one

#

is there even any point in having an anim graph do anything on a server?

worthy perch
#

If you want the dedicated server to play animations.

summer rivet
#

like replicate the "is firing" boolean on server then only do the animations and setting the boolean back to false on the clients. the variables would be out of sync but I wonder if that would matter and I just realized it probably would unless I just had animation variables lol

#

why can't this be plug and play.... it's like work or something, sheesh

hoary lark
#

why can't light just travel faster

worthy perch
hoary lark
#

i have, it's probably not what you want for a beginner-ish tutorial (and i'm pretty sure it's CPP only). it does work nice once it's all done though ๐Ÿ˜ฆ

worthy perch
#

is there even any point in having an anim graph do anything on a server?
And I just did a quick look, and it looks like networked root motion montages get played on dedicated servers.
I don't think you should put any netmode/authority checks in the AnimBP, is my position.

summer rivet
#

well I just tested with the variable, setting it to true in the player and replicating it and that works great

#

the issue is when the graph sets it back to false on the anim notify end it calls it on the clients and server

#

which then makes the server set it again which seems un needed lol

hoary lark
#

TBH any kind of "trigger" event I would start off with a function RPC, not rep'ing a bool

summer rivet
#

doing an is server check before setting it of course works fine, server sets it an replicates it, but I was trying not to replicate twice when I was using one multicast before

#

yeah that is what I have but the mention of an RPC failing was brought up

#

so basically trying ALL the options to gather info on good and bad for each

#

unless your RPC idea was server only and not a multicast

hoary lark
#

personally I'd do what you started with. as for a reliable variable rep vs a reliable function rep... especially for learning/non-AAA purposes/just building your game, use what works, not what is microoptimized

worthy perch
#

Also, multicasts and onreps are handled differently in C++/BPs. Very unfortunately confusing.

summer rivet
#

yep good to know all of this

#

would be nice to let people know "hey this is good to start with but if you need XXX or your goals are YYY you might need to look into ZZZ"

#

like no way in hell am I going to try and get into optimized client predictions or rewinding

hoary lark
#

if I found out later that rep'ing a bool was 9000x faster, I would use a bReloadTrigger and I would just initiate reload every time it toggles (also needing a bAbortReloadTrigger)

#

or otherwise ignore the setting of it to false

summer rivet
#

yep yep. Probably should not also tie in the actual reloading mechanic to the animation either I am realizing lol

#

because if your reload event gets lost... oy

hoary lark
#

sending one function RPC sounds cheaper than sending two bool RPC's (true and false to reset)

#

and send another function RPC abortreload if you abort reload

#

should be no need to send an isdone, in most common FPS type uses

summer rivet
#

actually question on that. assume a lag spike and you hit reload, it shouldn't reload or play the animation until your code goes thru to the server or should it play the animation regardless and the code is delayed?

#

I guess thats a design decision more than anything

#

I think the gist of networking is "nothing is the right way, it's just the way you need it to work to fit your design" lol

hoary lark
#

well that's where you get into prediction topics, gaining an understanding of how movement prediction works can of course let you extraplate over to other uses since it's all similar in concept

#

absolutely

summer rivet
#

yep yep so nailing the design at the start is important to cover, whoo learning ๐Ÿ™‚

#

100 person BR is going to have different design goals than a 5 person mmo hub based instance game

hoary lark
#

then after you design something like reloading prediction, you have to branch into cheat detection because prediction intrinsically allows the player to start shooting a full gun again before the server thinks he should... snowball effect. or you do it partway - show the reload animation locally but just let the player deal with a delay getting his gun filled up, usually it's less noticeable. I've seen that in a few small games I think

summer rivet
#

hmm even then you still have to have the server tell the other clients to play the animations so you can see the other player doing them so would you then have 2 calls? one for mechanic and one for animation but mark the mechanic reliable for example

#

you know making a game and not having to worry about this stuff must be amazing

#

like total ignorance

#

"hey bob why does our game use 1MB/s bandwidth" lol

#

I think I need to just realize you can't get around just simply doing some stuff unless you are a god tier programmer and can swizzle bits like a master and make every bit count

hoary lark
#

I actually haven't fleshed out the reloading networking in our project yet, I just spent a couple months doing our movement junk and moved onto other stuff ... but IDK, it might vary a bit depending on different genres of games. but usually yeah, the server "should" tell the player how much ammo he has (maybe just via a replicated int, in a simple doom-like shooter). having local prediction and correction checks the same way as movement should be able to make the whole process of server authority seem invisible as long as the connection is stable. but it's still, of course, complicated. hmm, i really need to think about this some more myself

summer rivet
#

hah

hoary lark
#

our game has jetpacks as equipment, like guns, and I ended up routing them through the movement component to build in fuel usage prediction for them. it works great

summer rivet
#

I think this is where people get stuck when learning MP

#

"simple" stuff becomes multiplicatively more complicated

hoary lark
#

sadly yeah, it's not a weekend activity, I took like a month or so part time on it, learning and implementing and fixing it up

summer rivet
#

๐Ÿ™‚

#

I think covering all the different ways to do the same thing is a great tool for learning and I've got 3 so far lol

#

well 3 that work, got a ton more examples that don't ๐Ÿ™‚

hoary lark
#

yeah. and this kind of thing, you really have to do it the naive way once to see how it doesn't work "nicely" to start grasping a handle on the difficulties prediction faces

summer rivet
#

yep yep ๐Ÿ™‚

#

sheesh even something like, hit reload and do you instantly get the ammo changed and the reload animation stops you from firing or do you hit reload, animation plays, then your ammo changes and you can fire or your option you mentioned do you allow reloading and can abort as well...

#

I only picked reload because I found an animation for it...

#

welp back to the drawing board, thanks for all the chat all ๐Ÿ™‚ so many problems

valid cliff
#

Should you really never use reliable multicast rpcs?

gleaming kestrel
#

Has anyone played with the advanced session plugin? How do I use 'filter'? What can I filter there? My own settings? or?

silent birch
#

That's sure @gleaming kestrel your settings

thin stratus
#

@valid cliff You can and should if needed

#

Just not stuff like OnTick

valid cliff
#

Thanks

gleaming kestrel
#

@silent birch Here is what I am doing: I can set extra setting (like MyServerName) to a session, and extract it when finding sessions as well (as shown in the picture). But I dont get how to set or use the filter option? I can make a 'sessionsearch' struct, but how do I fill it?

#

I could simply filter the array after I got the session list, but .. then what does 'filter' do at the beginning? (looks puzzled)

#

( in know I did not connect the 'add', that is not the problem, its how can I fill the struct? )

silent birch
valid cliff
#

when you simulate packet loss with Net PktLoss=10 and you use reliable replication (either rpcs or variables), are the simulated lost packets "resent" since the replication is reliable? and is it the same behavior as with real world packet loss?

thin stratus
#

@gleaming kestrel technically a filter makes sure that the sessions are already returned filtered

#

If the make struct thing doesn't give you any options then you should ask the plugin creator for help

gleaming kestrel
main spindle
#

If I want to do online multiplayer without port forwarding or such, do I need a steam app id? (that I have payed for that is)

gleaming kestrel
#

I am not an expert on this (just building my first multiplayer game myself), but as far as I understand, it depends on the subsystem you use.

#

You can inspect them in the engine.ini (or somthing)

#

if you set it to 'null', you will be able to use standard tcp-ip network discovery

#

I think

worthy perch
#

You would need to do port forwarding stuff.
I guess you could use Steam OSS with 480, but that's limited in someway (that I forgot).

bitter oriole
#

or not

#

You don't need a Steam ID to use Steam online

#

You can develop using the test ID

#

The question is whether you want to ship your game without Steam

#

Which for a multiplayer game is......... a really weird idea

gleaming kestrel
#

getting a steam-game-id costs what, 85 euro or something?

bitter oriole
#

$100

main spindle
#

yeah so what I mean is, if I want online multiplayer without port forwarding, I can achive that through buying a steam-game-id right?

worthy perch
#

Yeah, that would work.

gusty raptor
#

Hi, anyone knows how to replicate a ADefaultPawn over network? i was not able to find a good example with google..

#

meaning the movement (MoveForward,MoveRight etc.)

unique kelp
#

Probably a dumb question, but is there any scenario in which an actor does not have Role_Authority on the server? Provided the actor exists on the server, of course

grizzled stirrup
#

Is calling MyDelegateHandle.Reset(); on a DelegateHandle doing the same thing as ClearOnFindFriendSessionCompleteDelegate_Handle(0, MyDelegateHandle);if the goal is simply to reset the handle in order for it to be used again?
Having some really strange issues where steam callbacks aren't resetting the delegates properly
Only way I can get it to work every time is by using the former instead of the latter way to clear the delegate handle, otherwise it only works the first time and not past that
All other session delegate handles get cleared the latter way and work fine

gusty raptor
#

anyone has a good resource for my question?

bitter oriole
#

@gusty raptor This is quite involved

#

The UE4 multiplayer mastery course on Udemy shows how to do it

gusty raptor
#

@bitter oriole does it mean i have to do client side prediction etc. ? (like its not as easy as just replicating a variable?)

bitter oriole
#

No, it's not going to be nearly as easy

#

How hard depends on your game

gusty raptor
#

its basically just a flying pawn (like a camera) i'd like to replicate

bitter oriole
#

Is your game competitive ?

#

Do you have dedicated servers ?

#

Do you need physics ?

gusty raptor
#

its basically a rts , its gonna be a listen server, no physics

bitter oriole
#

Is cheating a concern ?

#

I guess not at all since listen server

gusty raptor
#

yup, its not a concern

grizzled stirrup
#

It's impossible to not have cheating on listen right as the host would always be able to cheat?

bitter oriole
#

Yeah

#

Then it's the easiest setup, you just need to simulate your camera with a velocity that gets updated with input

#

Then, the layer would RPC the server with location + rotation + speed

#

The server replicates that, probably as a struct, with COND_SkipOwner

#

And on replication, you do a quad interpolation for position, based on the average time between replication events

#

(The Udemy tutorial has all of that, though it also includes a more serious net model)

grizzled stirrup
#

Out of curiosity how often would you send that RPC?

#

Like 5 times a second?

gusty raptor
#

hah yeah i understand its hard as thats the easiest setup ๐Ÿ˜…

bitter oriole
#

@grizzled stirrup Personally I just do it every frame

#

Unreliably

grizzled stirrup
#

Wow that's a lot more than I thought but I assume the CMC does similar

#

Considering how much bandwidth it eats up

bitter oriole
#

I mean I just upload two floats myself so that's 480 bytes/s at 60fps

#

Hardly a problem

grizzled stirrup
#

I heard more that the frequency of RPCs matters and not just the actual data sent

#

But I have no real knowledge on the inner working so can't really justify that ๐Ÿ˜„

#

I guess since they are unreliable it's perfect

hoary lark
#

Yep the amount of bandwidth the CMC uses is dependent on your frame rate. It's the only way for the server to actually accurately reproduce the client's exact movement

worthy perch
#

I think in 4.23 there's a new project config setting to set the max net framerate? Something like that.

rich dune
#

Hey, did with UE4.23 anything change with the Steam integration?
I can't get the integration to work. In all other older projects it worked just fine. I can't create and find a simple session or unlock an achievement.

cedar finch
#

@jolly siren hey I just wanted to thank you for your suggestion. I changed all my characters walk speed to the same instead of setting it through the 'event begin play' now it works perfect. I was pulling my hair out before. Thank you so much!!! :)

jolly siren
#

no problem, glad I could help ๐Ÿ™‚

grizzled stirrup
#

@worthy perch Oh I'm very interested in that

#

That would mean RPC's etc. could only be sent at a max frame rate of whatever you specify?

#

Essentially making the bugs where you have to cap your game at 60 FPS when spawning / listening for invites no longer a problem?

#

240+ FPS in the main menu / when spawning in means trouble with the default settings

#
New: Introduced MaxNetTickRate, which defaults to 120, to limit how often the net connection ticks. This helps very high framerate clients to replicate without overloading their connections or wasting excessive amounts of bandwidth. MaxNetTickRate is configurable in .ini files by adding "MaxNetTickRate=120" (or your own value) to the "[/Script/OnlineSubsystemUtils.IpNetDriver]" section.
#

Beautiful

#

I'm going to set it to 60 as I don't see any cases where I'd need it higher personally

hoary lark
#

weird, I wonder what the ramifications of that are. in theory that should cause the client to desync from the server more (albeit on a very small scale, corrections might be unnoticeable)

grizzled stirrup
#

Most servers only replicate down to other clients around 24 times a second in the cases of Fortnite right? So it seems potentially a bit redundant to send more than 60 updates a second to the server in any case

hoary lark
#

it's about you sending your updates to the server

#

server to other clients, yeah that can be whatever

grizzled stirrup
#

Yes but if the server is sending others 24 then why do you need to send more than 60 to the server? Unless doing some gnarly lag compensation or heavily bound to the CMC for movement and need the accuracy

#

Luckily I am doing a co op game so I can get away with clientside CMC movement

#

So I can definitely send less updates to the server

hoary lark
#

right, that's just it - like normally the server can in theory "actually" 100% perfectly recreate your character's movement because you send it your exact movement every frame your PC ran, and the server CMC can run the math itself the same way. this gives the tightest possible movement tolerances for cheat checking, etc... I guess reducing the net tick rate would just loosen that up a bit. down to ~120 or even 60 it's probably insignificant, the more I try to imagine it

#

forcedly limiting game framerate always felt like a hack I didn't like doing anyway

grizzled stirrup
#

Got it! I'd say even so since we watch movies at 24 fps, sending at 60 would be well within accuracy for most cases right? Like 60 updates a second is a LOT: probably more than detailed enough for the server considering most games wouldn't allow drastic differences in movement within the space of 0.016 seconds ๐Ÿ˜„

#

And yeah I hate forcing the limit

#

It feels very hacky

#

I'm going to remove all that code that I had been setting whenever the player was in the main menu or spawning now

#

Also I would say that if you did require the 0.016 second accuracy, syncing animation state 1:1 would be far more noticeable than differences in position

#

and I believe most games do not sync animation state at all

#

They just play the anims based on certain replicated properties like speed or direction

hoary lark
#

by probably-wrong napkin math, in a fully server auth game, I think setting max tick rate to 60 might cause a typical FPS character to be corrected as much as/less than 5 centimeters after a movement... it might be enough to just be noticeable sometimes, maybe become a minor nuisance in a game like Arma where you're trying to peek around corners really accurately... not likely an issue in a game like Quake

grizzled stirrup
#

That's true, if going super granular like Arma then it makes sense

#

Most games however can be quite crazily out of sync without the client even noticing

#

All smoke and mirrors at the end of the day really especially with latency involved

hoary lark
#

the biggest thing is to make you feel like you're in 100% total control of your character. even small pops can really quickly ruin that immersion. but this seems probably small enough to be OK. glad I heard about it here ๐Ÿ˜„

grizzled stirrup
#

Yep! These are the gems you miss otherwise, thanks @worthy perch ๐Ÿ™‚

heady scarab
#

Hi, I'm trying to get an experiment working where I start a 1 player w/ dedicated server in PIE, and then let the client request a server travel via RPC that uses UWorld::ServerTravel(). What seems to happen is the server travels, but leaves the client behind and disconnected. Confusing since the documentation here (https://docs.unrealengine.com/en-US/Gameplay/Networking/Travelling/index.html) says the clients will be taken along; is it maybe something that works differently in PIE?

heady scarab
#

Also, if I use APlayerController::ClientTravel(), the client travels, but becomes the authority, so I'm guessing it's not connected to the dedicated server anymore, and is just hosting the new map locally.

meager spade
#

clients shot not call ClientTravel

#

Server calls ServerTravel which brings the clients with it

#

should*I

#

also in a dedicated server setup, clients should not tell the server to server travel

#

you connect to the server (say a lobby map). When server is ready, server will travel you off to the game map

#

also dedicated server testing in pie is a bit of a PITA

#

i prefer to launch the dedicated server process externally

heady scarab
#

Hmm, I have my project set up so I typically start PIE in a hub level, and it's client w/ dedicated server for that level (good). But if I 'enter a portal' to go to another map, I'd like to use a travel technique that preserves the separate client and server roles so I can test gameplay accurately.

#

It seems like the way I am doing travel just turns the client into a local server.

#

Also, calling a server RPC from the client player controller to execute the ServerTravel command would ensure that it runs on the server, right?

meager spade
#

yes

native pagoda
#

hope this is the best channel to ask... In multiplayer i need to control exponential height fog per individual player for indoor/outdoor environment. Is there any native solution ?? The only fallback i have in mind is to add an exp height fog to the pawn blueprint instead of the level, which has many drawbacks, but seems the only workaround. Post process seems even more inconvenient to manage.

rich dune
#

IMPORTANT! Since UE4.23 Dedicated Servers are broken. Even in an empty FPS example project I can't get a dedicated server to launch as a player controller is always invalid. In older versions of UE4 the same code and project works fine. Updating the project to UE 4.23 breaks it.

Does anyone knows a workaround?

fleet raven
#

wha? dedicated servers do not have, and never had, a player controller

bitter oriole
#

Well, they do

#

The authoritative one for each connected player, if any

#

Obviously on start, none available

rich dune
#

well there is currently never one for the server. Can wait forever

silent birch
#

Helped me but am not in front of my computer there, I have a problem, I made that if the life of the character are at zeros the character that destroys and a widget is displayed to him then a level must open and it works well. But the problem is that when it is the customer who dies the level only opens at home and it is also what must happen while when the server that dies the level opens at all the world

bitter oriole
#

@rich dune So why do you expect a PC to be valid here ? No connected client - no PC

rich dune
#

I need the PC to create a session on the dedicated server

fleet raven
#

you clearly don't since that would make "create a session" impossible

rich dune
#

without the PC there is no session a client could connect to. This is how I used it in 2 already released projects for years

fleet raven
#

probably works just fine passing null to it

rich dune
#

well then how do I create a session?

#

if I pass null to it session creation fales due to invalid player state

#

@bitter oriole @fleet raven This is how a dedicated server on an older project creates the session. At the same time with the same setup. It's on steam, working perfectly fine.

How am I supposed to create a session otherwise on a dedicated server?

fleet raven
#

what this did then, is pass null

bitter oriole
#

I have never used a dedicated server, or advanced sessions, so I have no idea

#

Just saying there's no way you ever had a player controller on a dedi startup

rich dune
#

what do you exactly mean @fleet raven

fleet raven
#

get player controller on a server before anyone joins always has and always will return null

#

so, maybe that create session node you're trying to use is broken now

rich dune
#

Then something massivly must have changed with UE4.23. I don't know how I should create a session now

silent birch
#

The node use lan of the create session actually works?

bitter oriole
#

On subsystems that support LAN, I gues

#

Which is Null, and...

#

Nope, that's it

rich dune
#

Yes lan works with null

#

but guess sessions are also broken in UE4.23

Well the list of whats not broken gets shorter and shorter ๐Ÿ˜ฉ

bitter oriole
#

Sessions are not broken

rich dune
#

well I can't create a session in this engine version

#

same setup works in 4.21

bitter oriole
#

@rich dune The basic problem is that you're looking in the wrong place

#

PlayerController always was invalid on dedicated at startup

#

Going back to UE3 a decade ago

#

This stuff doesn't change

rich dune
#

that might be true, but how else do I create a session on a dedicated server

bitter oriole
#

Looking at AdvancedSessions, the player is not used on dedicated servers, so it's not required, was never used, so you don't need it.

#

Just don't pass it.

#

That's it

rich dune
#

will test right now again

#

@bitter oriole Tested it now and it does not work. Sessions seams to get created but there is no session available

grizzled stirrup
#

If you want to specify a specific gamemode before creating a session (passing in a const FString& InGM to the CreateSession function and setting it like so: SessionSettings->Set(SETTING_GAMEMODE, InGM, EOnlineDataAdvertisementType::ViaOnlineServiceAndPing); What exactly is the string that you specify? A full path to the GM blueprint?

bitter oriole
#

So debug it

rich dune
#

Well I actually have not much to debug at this point

grizzled stirrup
#

Have you tried setting the join in progress bool to true?

#

Seems to count as being started in some cases even when just created or one player joins

rich dune
#

well this is just frustrating. UE 4.23 is such a horrible bad version for me at this point -.-

grizzled stirrup
#

Works great for me ๐Ÿคท

rich dune
#

I'm having constant crashes or strange errors that sometimes pop up while console development, some features are entirly broken and can't be used on some target platforms and now Multiplayer is also somewhat broken and does no longer work like in versions before

grizzled stirrup
#

Might be down to AdvancedSessions since that isn't an official plugin from Epic

rich dune
#

no same behaviour with the default session stuff

bitter oriole
#

Multiplayer in 4.23 works fine for everyone

#

Sessions work fine

#

Your project does something weird that maybe worked previously and now doesn't

#

So debug it

rich dune
#

this project is entirly empty :D
There is nothing to debug.

it's a blueprint FPS template, the default Steam config integration, a create session in the gamemode and a search session funcion in an empty main menu map printing out strings.

this is the lowest you can go and it still failes

bitter oriole
#

No it's not

#

Try without Steam first

rich dune
#

I'm sitting here for a week trying all strange combinations and the only thing left I can say is. UE 4.23 is broken and in older versions it works

bitter oriole
#

Okay well, revert to 4.21 and enjoy life

rich dune
#

I can't, Publisher is requesting a prototype in UE4.23

bitter oriole
#

You'll have to change publishers, since 4.23 is broken apparently

rich dune
#

seams like it

bitter oriole
#

For what it's worth I have working sessions & MP on 4.23

#

Epic shipped some version of Fortnite on a similar version at some point

#

And it's not even the .0 release, we've already gotten the first hotfix

#

It's much more likely that your project specifically does something wrong

rich dune
#

that does not mean much. there are massive issues in consoles which are not fixed for 2 major versions now

bitter oriole
#

You can either be in denial and go back to 4.21 forever or actually try fixing your issue

#

I'm sure there are 5,000 bugs in 4.23, but sessions and MP at least work correctly as far as I can tell

rich dune
#

I would like to fix it. but I'm all out of ideas what to test and where

bitter oriole
#

Try without Steam

#

Without advanced sessions

#

Or with, doesn't really matter

rich dune
#

already done

bitter oriole
#

Do a simple listen server, create session, search session

rich dune
#

everything tested. listen sessions work, dedicated server sessions not
the exact same setup is always working in 4.21 and not in 4.23

it does not matter if i convert the project from 21 to 23 or 21 > 22 >23 or create a entirly new project in 4.23 with the same setup. it always failes in 4.23 with dedicated server

timid moss
#

maybe try creating an entirely new project with a different setup?

rich dune
#

which setup?

timid moss
#

if your goint to test by creating a new project why would you create the same setup you had before?

rich dune
#

well the setup I have is bare bone

silent birch
#

This is normal since you probably download the plug-in on Chrome but a plug-in 4.22 or 4.21 you have to download the 4.23 otherwise nothing @rich dune

timid moss
#

find it hard to beive that dedicated server is broken

#

also you could just try redownloading ue4

rich dune
#

I'm already testing with 2 different PC's with one PC rebuilding UE4 2 times over the week with the same result

silent birch
#

Before you got the 4.23 it worked? @rich dune

rich dune
#

yes I can create this in 4.21 right now and it works on first try

silent birch
#

But on 4.23 it does not work? @rich dune

timid moss
#

starting to feel like your just pulling some late April fools joke on us now ๐Ÿ˜…

rich dune
#

@timid moss blizzcon is apparently coming but no thats not a out of season april fools joke ๐Ÿ˜ฉ
@silent birch Exactly in 4.23 it's not working

timid moss
#

maybe

#

give up

#

lol jk

silent birch
#

OK then download the plug-in 4.23 not 4.21 or 22 @rich dune

rich dune
#

which plugin?

#

even if not using any plugin it fails

silent birch
#

I am talking about the subsystem 4.23 online plugin @rich dune

grizzled stirrup
#

I am passing in a gamemode string that is the full path to my gamemode blueprint and then trying to filterSessionInterface->FindSessions() with this query setting SessionSearch->QuerySettings.Set(SETTING_GAMEMODE, InGM, EOnlineComparisonOp::Equals);

#

However it never filters and always joins me with any available session even if it is using a different gamemode

#

Do I have to manually do an if check like if (SessionSearch->QuerySettings.Get(SETTING_GAMEMODE, RequestedGM) == InGM) ?

#

If so that seems to make the EOnlineComparisonOp::Equals kind of pointless..

silent birch
#

Can be @grizzled stirrup

grizzled stirrup
#

What do you mean?

#

Should I be doing that additional if check?

silent birch
#

testing @grizzled stirrup

timid moss
#

Hey guys. I am trying to figure out the best way to replicate aim offset of the character mesh for my FPS game (when player looks up other clients can see your mesh look up). I have the calculation working but my problem is it only shows up on the client. I have looked up how to solve this and it looks like people online are saying to make the offset variable replicated and then do a server RPC every frame to update it. This will work, but doing an RPC every frame worries me. Is this how everyone does this? Or is there a better way?

grizzled stirrup
#

@timid moss Here's how I do it:

    // Replicate the view pitch of this player to everyone except himself
    FRotator CurrentRot = FRotator(CurrentViewPitch, 0.0f, 0.0f);
    FRotator TargetRot = (GetControlRotation() - GetActorRotation()).GetNormalized();
    FRotator FinalRot = FMath::RInterpTo(CurrentRot, TargetRot, DeltaTime, 5);
    CurrentViewPitch = FMath::ClampAngle(FinalRot.Pitch, -90.0f, 90.0f);
#

That's on tick and CurrentViewPitch is replicated to everyone except the owner

#

How does ShooterGame match a simple string to a gamemode here?

    const FString GameType = TEXT("TDM");
    const FString StartURL = FString::Printf(TEXT("/Game/Maps/%s?game=%s%s"), TEXT("Sanctuary"), *GameType, TEXT("?listen"));
#

Found it, you can create an entry in DefaultEngine.ini like so +GameModeClassAliases=(Name="TDM",GameMode="/Script/ShooterGame.ShooterGame_TeamDeathMatch")

meager spade
#

ya

#

you can do it in the editor aswell

supple pelican
#

Hey guys. So Iโ€™ve recently been playing with the voice module, and I get my microphones audio data captured into memory and compressed. Iโ€™m trying to replicate this audio data to client that are close to me. My first thought was RPCing the server with the data then I got a warning about my array being to large. I know that I can change the max array replication size but I was just wondering if there was a better way to do this

fringe dove
#

@supple pelican you may want to just use in-world voice chat

supple pelican
#

What do you mean?

fringe dove
hoary lark
#

@timid moss if you are really worried about bandwidth... it is possible to compress float values and send them over the net packaged as uint16 (2 bytes) or even uint8 (1 byte). but it might not be smart to bother until you've realized you're starting to have a problem and it would help. (i'm not smart, so I wasted the time and did it from the onset) https://hastebin.com/azosidapab.cpp

supple pelican
#

I canโ€™t pipe the data through Steam OSS or whatever. Project wonโ€™t be using steam or any OSS for that matter.

twin juniper
#

Is there a free service I can use to master-list hosts?

harsh lintel
#

I'm trying to get hit result under cursor for objects in a client rpc and it returns false always, the collision settings of the actor are in the #blueprint channel, idk if it's a multiplayer or a blueprint issue so maybe someone here can help

viscid bronze
#

is it always possible to use an already existing Third Person Character blueprint in Multiplayer

winter zenith
#

@gleaming vector Hi! I was having a bit of a search re UObject replication (initially for use in an inventory system where Outer may change) and ran into quite a few comments from you a few months ago. Are you still happy using replicated UObjects for your use case or given another shot would you use something different? So far replicated UObjects are working out ok for myself though I'm not too deep in the rabbit hole just yet. Also did you ever find out a good solution for having Outer changes replicated, or was creating a fresh UObject the eventual solution there? Thanks a lot ๐Ÿ™‚

gleaming vector
#

i ended up duplicating the object

#

the response i got from epic was "nope you can't do that" in a lot of words

winter zenith
#

Ah that's a little frustrating, but good to know that's the case. Given that do you still feel that replicated UObjects are a good fit? (using something like AActor seems too heavy, esp for something that doesn't have world presence)

gleaming vector
#

yes

winter zenith
#

Awesome. thanks a lot! ๐Ÿ™‚

gleaming vector
#

basically

#

in my usecase

#

I basically had to replicate properties

#

and there was a lot of per-type properties that I really cared about having, but didn't want other objects to have those properties

#
const int32 Method_Rename = 0;
const int32 Method_Duplicate = 1;

void UArcItemStack::TransferStackOwnership(UArcItemStack*& ItemStack, AActor* Owner)
{
    const int32 TransferMethod = Method_Duplicate;

    if (TransferMethod == Method_Rename)
    {        
        ItemStack->Rename(nullptr, Owner);
        //Recursively rename out substacks
        for (UArcItemStack* SubStack : ItemStack->SubItemStacks)
        {
            TransferStackOwnership(SubStack, Owner);
        }
    }
    else if (TransferMethod == Method_Duplicate)
    {
        UArcItemStack* Original = ItemStack;
        ItemStack = DuplicateObject(Original, Owner);
        //We don't duplicate our sub objects here, because PostDuplicate handles it
    }    
}```
viscid bronze
#

is there a tutorial somewhere to use an already done TPS character controller blueprint and make it multiplayer

faint dock
#

@viscid bronze the default TPS character uses the character movement component (CMC) which supports multiplayer movement all the other stuff you want to add doesnt just magically work for multiplayer

#

look up some replication tuts on youtube if you want to learn more

viscid bronze
#

alright, cool ill try that, thx @faint dock

lunar sedge
#

I'm a noob to networking, but am looking to better understand how UE4 utilizes C++ and multiplayer. I was beginning with the Action RPG documentation and live streams, but they mention Action RPG is not designed for multiplayer. Instead, the hosts directed those interested in networking to the Shooter Game example. Does Shooter Game utilize Epic's Ability System similarly to Action RPG? Will these live streams on Action RPG help inform how Ability Systems works when cracking into Shooter Game?

bitter oriole
#

There is a lot to unpack here

pallid mesa
#

@lunar sedge ShooterGame doesn't use GAS, and the action rpg example is a full pledged singleplayer example of how to use GAS.

Something that Epic is missing on their examples is a GAS appliance for multiplayer environments, for that you'll need to do more diggin.

However if you are getting into multiplayer I would recommend you understanding the basics. There is a great resource shared here and PINNED in this channel which is the "cedric eXi" network compendium which will walk you through several important concepts of networking.

My first recommendation for you is to do a toy project using the basic multiplayer features UE4 offers (RPC's and whatnot) and then deep dive onto your preferred specifics.

bitter oriole
#

The three concepts you need in UE4 for multiplayer are replication, RPCs, and sessions. GAS is a huge plugin that can be useful for some games, though I wouldn't use that without learning the rest first

gusty raptor
#

Hi, when i spawn a blueprint actor it seems to replicate, but a c++ not. do blueprint actors have some net settings enabled by default?

lunar sedge
#

I have used Cedric's previously, but will jump back in and see if I cannot glean some more from his awesome work. Thanks, both.

crimson fiber
#

why do actors on level replicate very slowly? I have several thousand which should replicate only one variable. before I spawn a character replication goes slower and slower, after spawn it seems faster but not for a long time. MinNetUpdateFrequency = 50, NetUpdateFrequency = 100

#

basically I have to wait minutes to get all actors replicated

bitter oriole
#

Relevancy might be a factor here, but... thousands of replicating objects may be a bad idea

worthy perch
#

MinNetUpdateFrequency = 50, NetUpdateFrequency = 100
Those are some big numbers.

crimson fiber
#

and I expect big replication but it's slow

fleet raven
#

might need more bandwidth there, and using replication graph to keep the server from dying prioritizing 1000 actors between more clients

crimson fiber
#

there is no other actors or data to replicate on scene

#

server seems perfect, no hitches on it

fleet raven
#

does this variable ever change

crimson fiber
#

everything is tested on same pc

bitter oriole
#

100 frequency for a single byte with 5000 actors means 500KB/s bandwidth, which is way more than makes sense

#

UE4 has several limits on bandwidth that needs to be adjusted here

crimson fiber
#

no it's COND_InitialOnly

fleet raven
#

that changes things I suppose

worthy perch
#

Assuming you just need that one property replicated and nothing else, would setting NetDormancy matter in this case? I would assume it would help.

crimson fiber
#

we tried that but had no luck, maybe we don't know how to use it properly

fleet raven
#

have you tried using the network profiler

crimson fiber
#

never is it difficult to setup?

worthy perch
#

Nope, very easy.

crimson fiber
#

ok I'll check that. I hope it'll show me where the bottleneck is

worthy perch
#

Does your output log/s say nothing?

crimson fiber
#

I just see that OnRep function is fired with slow rate

#

it goes from 10 actors/sec to 1 per 5 sec

#

maybe I should attach controller and spawn character right away to make NetPriority calculate correctly idk

worthy perch
#

If I had to guess, I'd say you have a CPU problem from the large amount of actors with high netupdate frequencies.

frosty hazel
#

Hey there. Unsure whether I should put this here or in #umg. I'm having issues with user interfaces in multiplayer, and I think these issues stem from my not knowing the best practice for setting up UI for multiplayer. Currently, when I want to show something on the UI when a after something happens to a pawn, I use a run-on-client RPC, getting the pawn's controller, and using IsValid to call all of my UI events. I know there must be a better way, but I haven't found a definitive answer.

The current system keeps drawing the UI twice on the server (when packaged) but I'm not so much worried about that as I am about actually doing things the right way. Something tells me that issue should disappear if I actually get a good system in place.

meager spade
#

UI is local only, server should not really handle any UI logic. it shouldnt even have UI stuff on the server unless its a "listen server" with a player controlling it

frosty hazel
#

I'm using a Listen server. sorry - should have mentioned

meager spade
#

the the UI should only be on the local player

#

gated behind IsLocallyControlled

#

to show the widgets

frosty hazel
#

Okay, there's an IsLocallyContolled node that I should use when calling widget events from a player pawn?

meager spade
#

ui shouldn't really be called from replication (i mean a client rpc from the server is ok to show a widget on demand if the server wants the player to)

frosty hazel
#

Okay. Client RPCs if I want to call widget events from server side things like the game mode BP, and IsLocallyControlled for pawns. I'll see if I can't come up with a streamlined system using those

meager spade
#

yeah

#

gamemode would have to client rpc on the player controller

#

like i have a lot of my client rpcs on my player controller

#

server can just grab a controller, and call a client rpc on it

#

and i know it will fire on the owning client

#

like the gamemode will show the end game screen to all players, so it calls a client rpc on the player controller

frosty hazel
#

Okay, that makes a lot of sense. I'm in class so I have to go - thanks for your help!

tawny mason
#

hey guys any good references for docs ? The docs in the oficial site don't explain it in enough depth IMO

meager spade
#

explain what?

tawny mason
#

Just general networking and maybe some more in depth examples and such

#

no specific game type or anything just curious about it

hoary lark
#

Pinned messages. "Network compendium" by Exi

chrome bay
#

ShooterGame is still a decent example project

#

If a bit old-fashioned

meager spade
#

they need to remove slate

#

and update it for UMG

#

no one wants to learn slate as learning resource now UMG is available

exotic axle
#

I have a problem with AI character replication. I have a default mannequin, with an AI controller, driven by a simple behavior tree. All it does is run between 2 target points. When I have 1, it seems to work fine even with multiplayer. When I add 1 more, it starts to break down. The characters start jumping around randomly. When I add 6-7, it breaks down completely and all the characters are warping constantly. All the replication settings are default. I'm not sure how to start debugging/tweaking/fixing this.

#

Odd thing is: in the unreal editor, it doesn't break if I have only 1 player + dedicated server, but it does break when I add a second player to it.

hoary lark
#

consider taking a video, and check through all of the Stat Net statistics for weird things. look for net saturation. @exotic axle

#

(actually, I just realized I don't know how to watch Stat Net on a dedicated server, lol)

ember slate
#

Yaw is always 0

#

On server

#

Why?

high current
#

The player controller by default only replicates yaw actually, but input events happen only on the client, and you are not sending your axis value to the server currently

ember slate
#

Wait, so all input events aren't sent to server at all?

high current
#

The event itself no, but the player controller and the character movement and pawn all have functions that take care of this

#

Things like Add Yaw Input, or Add Movement Input

#

these functions take care of this for you

ember slate
#

I see

high current
#

The player controller however as stated before, doesn't replicate Pitch, but idk if you care for that just yet

ember slate
#

Not really

#

But thank you

#

How would you handle this situation then: I need the player whenever not moving to face the camera's direction

hoary lark
#

are you using the default character movement component? it has a setting to "use controller desired rotation"

ember slate
#

On servers and clients

hoary lark
#

on tick, if velocity is nearly 0, print current velocity

ember slate
#

But its not 0, the player is actually moving on my screen

hoary lark
#

I just wrote out what your code is

#

study your graph a bit more until you see it

ember slate
#

Oh I see

#

Anyways it doesn't change the fact that the velocity is always 0

hoary lark
#

if velocity is 0, print the current velocity

#

what do you expect this to do?

ember slate
#

Hello is never printed

hoary lark
#

hold on a sec. you're getting the velocity of the player controller. do you want to get the velocity from the character movement component instead?

ember slate
#

Well is it wrong to get the velocity of the player controller?

hoary lark
#

the player controller actor isn't the player character actor

#

I have no idea what the "velocity" of the controller actor would do during runtime TBH

#

you should be able to GetVelcoity from either the character actor, or its movement component (if you run it on the actor, unreal will pull the velocity from the movement component for you)

#

fix that first and see where you're at

ember slate
#

Well now it works

#

When I did that

#

Alright

#

ty

silent birch
#

In my game I made a system of random spawn level elements, and the problem is that for example at this point there is a weapon that spawn and the server sees it well but the customer sees something else

faint dock
#

sound like the thing you spawn is not replicated

twin juniper
#

I'm confused I am trying a system with n players (with dedicated server), up and down move back and forward and left and right rotate around the local z axis. So far my back and forward movement replicates so all other player see it (I don't know why as I don't use character movement component or manually replicate it but it just works). My rotation replication is fine AS LONG AS the player does not move back or forward at the same time. Here is what I do

#

The rotation replication works on the spot, but as soon as I move back or forward as well, the rotation appears fixed from other players' point of view, though not the owning player's.

silent birch
#

It is replicated even in multicast @spaq#4532

silent birch
#

For the character of the game I also made a random spawn and it works but the problem is that for a player there are two characters who appear

meager spade
#

@twin juniper i wouldn't use Reliable RPC's in a Tick based function

#

also this here

#

you are setting the rotation to 0

#

everytime back or forward is pressed

twin juniper
#

the 0 is the amount of rotation that is added

meager spade
#

you are setting the rotation to 0

twin juniper
#

no the function just adds a rotation

#

I also did a get - set

#

to try and update it on clients

#

thats why I added the function with 0 input

silent birch
#

I will post photos not screenshots because the discord on my computer is taking time to open (it does not even open but it just loads) sometimes I post screenshots because that's my father's connection

twin juniper
#

I can get location to replicate, and rotation to replicate, but not both at the same time ๐Ÿ˜ข

hoary lark
#

think you'll need to share more blueprint code and behavior. you've implemented your own custom Add Movement Input function for your custom pawn then? does the character "stop turning" when you're moving or does their orientation reset to north?

#

or using the default AddMovementInput with no CMC attached?

twin juniper
#

as soon as I change the location, the rotation resets to north

#

but I can turn on the spot and that replicates

#

resets to north from other clients' PoV, from player's pov is fine

#

whats CMC if I may ask

meager spade
#

your movement isnt set to control rotation?

#

or w/e you are using to move the actor forward

hoary lark
#

char move component, think you said above you don't use it

twin juniper
#

oh yes. I think I used that at first but add movement input replicates for some reason

meager spade
#

if the control rotation is not updating

#

when he moves forward it will snap back

hoary lark
#

what does AddMovementInput even do if a pawn doesn't have a movement component

#

maybe share your ServerInfo RPC too just in case

twin juniper
#

need to go in 10

hoary lark
#

you're also apparently rotating your mesh component but not your actor, is that what you think you want?

#

sorry, you're doing some weird things here. on clients, you rotate the mesh in local space and then you set their pawn's control rotation to their pawn's current control rotation?

silent birch
#

Please So who can help me?

grizzled stirrup
#

Is this the best way to check if a session exists? if (SessionInterface->GetNamedSession(GameSessionName)) My game crashes when I'm playing directly in the map in PIE without going through the main menu to create a session and Session->StartSession() gets called so I want to make sure it isn't null before starting.

#

Actually that does not seem to work either ๐Ÿ˜„ Still crashes

silver lotus
#

Check your logs <GameProjectDir>/Saved/Logs

#

Sounds like something a bit more screwy is going on there.

grizzled stirrup
#

Nah it's just that when playing in editor directly on the map, the session is null as I didn't go through the usual process of creating one in the main menu

#

It works fine just crashes if trying to directly start or update a session that doesn't exist

#

So just wondering if I can check if the session itself is null, if not then it's assumed to be testing and doesn't need to call the functions

#

Can do a bool in my GM but it's less flexible as I need to remember to turn it on / off when testing for real

silver lotus
#

Why not add a branch if it's editor?

#

I think there's a node for it

#

yeah apparently With Editor node exists

#

๐Ÿ™‚

#

So if youre running in editor and the session is null, create it ๐Ÿ™‚

silent birch
#

Hello again

silver lotus
#

Hello

silent birch
#

Do you have a solution to my problem?

silver lotus
#

What's your problem? I haven't been watching the conversation

silent birch
#

OK

#

In my game I made a system of random spawn level elements, and the problem is that for example at this point there is a weapon that spawn and the server sees it well but the customer sees something else

#

For the character of the game I also made a random spawn and it works but the problem is that for a player there are two characters who appear

#

So there are two problems

silver lotus
#

So based off what you've told me, your client AND server are spawning the player

#

Only the server should handle it.

silent birch
#

No

#

Wait

silver lotus
#

Yes

#

Skimming the above you said you're multi-casting

#

That would run on server and client

#

Why not Run On Server instead of multi-cast?

silent birch
#

The problem with my random spawn is that if for example on a wall the server sees that it is a weapon that appeared and the customer sees for example a knife, but that's not what must happen, he must see the same thing

silver lotus
#

Yeah so the server needs to tell the clients what it should be seeing

#

So server would say "Okay client, I am spawning A ROCKET LAUNCHER at Position 1"

#

If your spawnable item is replicated it should actually spawn from the server onto the client in the right location if I remember correctly

silent birch
#

My random spawn code runs at the beginning of the game and is done in the blueprint level

silver lotus
#

I don't think blueprint level is the right spot for it but lets work with what you have so you get the concept

#

Got a screenshot?

silent birch
#

My random spawn is a custom multicast event

hoary lark
#

kittens is right. you need to spawn stuff on the server only.

silent birch
#

I will post photos not screenshots because the discord on my computer is taking time to open (it does not even open but it just loads) sometimes I post screenshots because that's my father's connection @silver lotus

#

Sorry @silver lotus

silver lotus
#

No worries mate.

#

The only time you spawn anything on the client is non-gameplay essential things like decals and stuff

#

Cosmetic. That's the word I was thinking of

hoary lark
#

yep. spawn it on the server, if the actor is set to be replicated then the server will handle creating it on each client for you

silver lotus
#

Switch Has Authority is a great node you should look at @silent birch - It returns Authority or Remote.

#

That would probably solve your issue in the blueprint level class.

silent birch
#

OK

#

I know this node and I've used it many times in my game (switch has authority)

silver lotus
#

Ive not used a level blueprint before, but I believe that every player executes it

silent birch
#

OK

grizzled stirrup
#

@silver lotus Thanks for the answer- only problem is that I often do test with valid sessions in the editor if I go through the main menu. I'm sure the is a way to test if a session is null or not

silent birch
#

Thank you it work @silver lotus

#

For the character of the game I also made a random spawn and it works but the problem is that for a player there are two characters who appear

silver lotus
#

IsValid node would probably be what you want kyle

#

@silent birch Same issue.

silent birch
#

For this problem, who can help me?

#

OK

#

I try

#

It did not work

#

This problem is only at the customer's @silver lotus

#

You have no solution?

silver lotus
#

You're spawning two players. In your spawning logic, do a print string

#

If it says CLIENT: Hello and SERVER: Hello

#

It means your running that logic on both.

silent birch
#

OK

silver lotus
#

The server is responsible for all player spawning, and I would put money on it that you're spawning them on both ๐Ÿ˜›

hoary lark
#

you're doing the same thing but this time, your character is probably marked to replicate properly already (your guns weren't). your server spawns one, your client spawns one (from the multicast), then the server tells the client to spawn a copy of his

silver lotus
#

^ That.

silent birch
#

The print string says that the code is good

#

But the results are bad @silver lotus

silver lotus
#

Are you multicasting for the spawn?

silent birch
#

No run on server

#

So?

silver lotus
#

Not sure mate.

#

I still think youre spawning on client.

silent birch
#

You told me to put run on server and I make them @silver lotus

silver lotus
#

Do a print string on that function.

silent birch
#

I did it and this chain of expression was only played once

silver lotus
#

is your player replicated

silent birch
#

Yes

#

So?

#

It still does not work @silver lotus

silver lotus
#

Not sure mate. Maybe @hoary lark has an idea?

silent birch
#

OK

#

@hoary lark please, you can help me with my problem?

silent birch
#

Finally it does not only happen at the customer's, because I tested the game on a player and that's also product @silver lotus

#

There is no more problem. The problem came from the World settings that I did not choose Game Mode and I chose a game but the default pawn in the world settings I did not put anything but because of that at the beginning of the game the customer n no character to control @silver lotus

#

Why

silver lotus
#

Sorry, I'm not sure I understand what youre saying.

Youneed to define a default pawn in either a Game Mode (Which then needs to be set as default) or do it in your world settings

silent birch
#

But I already have a random spawn so why put something in the default pawn of the game mode? @silver lotus

silver lotus
#

Because that's how pawns get spawned by the engine?

silent birch
#

OK

#

I know. But it is also this default pawn there that in the level there is an actor of more @silver lotus

#

So how make?

dark edge
#

Where do you guys do all your stuff like spawning pawns and handling state changes? I have it in Playercontroller right now but I'm thinking Gamemode would be the best way to do it?

meager spade
#

GameMode and GameState

#

thats the idea behind them

#

remember GameMode is server only

dark edge
#

Yeah I'm thinking Gamemode. I'm trying to set things up in a robust way so the game pretty much flows the same whether standalone, server, or client. I'm using highly modular player pawns, does using RepNotify to trigger setup code sound like a good approach?

gleaming kestrel
#

Here is a snippet I use all the time:

#

by Yun-Kun 06-02-2017, 03:37 PM
GameInstance (an object spawned when you launch the application and that remains the same until you close it)
GameMode (spawned when a level is loaded)
GameState (spawned by the gameMode)
PlayerState (spawned when a PlayerController is spawned = when a player arrives in the game)

You have to pay close attention to what you do and where you do it when coding a multiplayer game. When it comes to singleplayer, you can't really "have it wrong" except for GameInstance stuff.

But here are the general guidelines I follow:
GameInstance - Holds any non-pointer persistent variables (persistent means that you need to store in between two levels and that you don't need to store in a SaveGame)
GameMode - The overall game manager - starts and stops the current game space you're in, handles the GameStates and how they rotate - an example might be "King of the Hill"

GameState - Keeps track of every data relative to the current state of the game (timers, scores, winning team) that all players in the game need to know about, handles scripted events related to the state

PlayerController - HUD, Camera, Mouse, Keyboard, Gamepad, Inputs calling actions on the Character.

PlayerCharacter - Actions in response of Controller's input + Holds personal infos and stats (Health, Ammo - but Ammo might on your Weapon Class if you can switch Weapons).

PlayerState - Holds every variable non related to the PlayerCharacter that needs to be known by everyone (best scores, current killing streak, player name...)

exotic axle
#

So I sort of figured out the cause of my issue earlier. The reason why the mannequins I had were warping around was because their network priority was too low, so the problem fixed itself when I upped the net priority. But that means the game is net saturated even though all I have are 2 vehicles and 7 mannequins running around updating at 10 times / second. Any idea why that could be? (I'm not sure how to read the net stat counters, which numbers are high/low, relevant irrelevant... etc)

dark edge
#

how is 8 kB saturated?

exotic axle
#

It says num client saturated = 2 ยฏ_(ใƒ„)_/ยฏ

#

And I have 2 players

#

So I assumed both connections I have are saturated

#

Also, if I lower the net priority of my mannequin characters, they warp around. I was told that the net priority shouldn't matter unless the game is net saturated.

hoary lark
#

the default bandwidth settings are very low - I think about 10 KB/sec up or 0.08 Mbps. I increased mine a bunch. 4.23 also has some "net tick rate" setting added that should help, we discussed it in here... yesterday?

#

Floss Last Tuesday at 9:45 AM
I think in 4.23 there's a new project config setting to set the max net framerate? Something like that.

#

@exotic axle go find that convo if you're using 4.23, else you can look up how to increase your project's bandwidth limits to more modern levels instead of UT2004 levels

gleaming kestrel
#

Lol, got an error compiling my own class because I stupidly called my project 'NetworkGame' (which turns out to be ambigous), so I renamed my project and map folder, reopened: nope. Broke the project. Renamed them back: Nope. Project broken. O..M.. G! lollll! (have to start again.. AGAIN...) /make note to self: never use names that can be ambigous ...

#

Use backups you say? /make note to self: make more backups.

waxen quartz
#

Is it possible to talk directly from a client to client, instead of having to make a server call then propagating it? Going from client 1 -> server -> client 2 can add a decent amount of ms that might be able to be avoided if I could just go from client 1 to client 2.
I have my own custom movement component with prediction built in, and I was wondering if it was possible to pass over the predicted state from a client to the other clients before the server simulates it and propagates the real game state after.

exotic axle
#

@hoary lark thanks

dark edge
#

@waxen quartz It'll be really hard. You'll probably have to do nat punchthrough etc. And what are the chances that client to client ping is faster than client to server to client?

waxen quartz
#

@dark edge yea it sounds like a real pain lol
Isn't it almost always faster? Fastest way is a straight line, if you reroute through server you will always add extra ms

#

My game uses listen servers so I'll probably end up doing nat punchtrough anyways

silent birch
#

@dark edge I'm doing my random spawn code in the blueprint level. But I also tried in the Gamemode

glad wharf
#

@waxen quartz P2P in games is generally a bad idea

#

you want to have a server. I remember reading an article on the subject, some old RTS games did use P2P, but it has some clear limitations, and for instance for a FPS it's a nogo

waxen quartz
#

@glad wharf yeah generally speaking. In my case it's basically a fighting game, 1v1, and since I'm using listen servers technically speaking cheating is possible

glad wharf
#

ah yes indeed

dark edge
#

@waxen quartz if it's 1v1 then there's already only one client...

waxen quartz
#

Sorry I didn't specify, it can also be 1v1v1 or 2v2

#

But most of the time it's gonna be 1v1 anyways

dark edge
#

I wouldn't worry about it. If you go dedicated then the servers are gonna be on a nice fat pipe and if not, the server is in some random dudes basement which would be just as far as anyone else in most cases. Only time you'd have extreme ping differences are if some are on a lan together and some aren't.

waxen quartz
#

Yea you're right, I was just wondering if anyone has done something like that in case it warranted the effort. Thanks

silent birch
#

Hello again

hoary lark
#

@waxen quartz if Crowbcat has made a video making fun of it then you don't want to touch it with a 99 ft pole ๐Ÿ˜„ https://www.youtube.com/watch?v=38sPNZ8QHO4
(actually I would love to see some example of a coop P2P FPS... not sure if any have ever existed)

real yacht
#

when calls RestartGame from GameMode

#

does that clear everything, variables, arrays, actors..etc

#

?

#

from source code i can see that restartGame do ServerTravel with "?Restart"

#

parameters

twin juniper
#

Is it normal to get a lot of lag when I simulate multiplayer by opening multiple screens

slim falcon
#

@twin juniper You mean with lag low fps? Then yes

unique kelp
#

Any resources I can read up on for groups of zombie-like AIs in multiplayer?

#

large-ish groups, around 100 total entities

#

Even disabling most of the collision/overlap checks, disabling shadows and similar stuff I get unmanageable fps drops

#

Similar to this stuff

meager spade
#

the biggest impact is going to be the movement componen

#

also Animation Sharing is a thing now

#

as they use the same animations, you can share them

unique kelp
#

Yeah we are already thinking about nuking the movement and doing our own thing

#

would animation sharing only work for actors that are all synced?

meager spade
#

it uses blends,

#

and it pools the animatiosn

#

animations

#

so they don't have to be doing the same thing

#

but if they are it shares

unique kelp
#

Ok, I'll look into it, that should help on the client side

meager spade
#

dedicated server?

unique kelp
#

yeah

meager spade
#

make sure animations are not played on it

#

help keep server load down a bit

unique kelp
#

some attacks are anim dependent right now though

#

slices and such

meager spade
#

like notifies?

unique kelp
#

yeah

meager spade
#

notifies still fire on server

#

just bone locations cant be used

#

as they don't update

unique kelp
#

:/ so I'll have to move away from attached weapon collisions to hitboxes

meager spade
#

server will be in A or T pose

unique kelp
#

not a big deal, have been wanting to do that anyway

#

thanks ๐Ÿ™‚

waxen quartz
#

@hoary lark Well I don't have ubisoft's budget to be able to afford dedicated servers, if the game gets large enough that cheating becomes a concern I'll look into it lol
Aren't all co-op fps games p2p? Or are you not including listen servers as p2p

#

Also my game at most will have 4 players in a short match and in the common case will only have 2

bitter oriole
#

P2P isn't listen server

#

Listen server is one player hosting and every player connected to them

#

Dedicated server for 4 players is dumb, unless you are doing a competitive game. 2/4 players is extremely often done with P2P/listen server

#

As to client-to-client connections, Steam does NAT punch for you if you're on Steam, but you can't have P2P in UE4, not easily

finite fractal
#

is a listen server good for 12 people

bitter oriole
#

12 is a bit much I think

waxen quartz
#

@bitter oriole yea it's a comp game, that's my main reservation with listen servers. But most fighting games are p2p anyways so I wonder how they do it lol

bitter oriole
#

Most fighting games have very simple netplay setups

#

They're more predictable

#

You can easily have each player detect cheats, and simply ignore them

chrome bay
#

You don't have to pay for servers yourself, communities can host them themselves via 3rd-party providers

#

Pretty common setup

#

Need a reasonable audience for the game to make it worthwhile though

bitter oriole
#

^ though you'll always need your own official servers to maintain the community

chrome bay
#

yeah v true

bitter oriole
#

Personally I just stay away from anything competitive - I don't want to spend half the dev time doing anticheat

waxen quartz
#

@bitter oriole yeah I was thinking of a system like that, since damage/knockback/etc. Are fixed values I can always validate it with relatively simple math. I'm not sure what to do if it's the client that detects the inconsistency, there's no client_validate LOL
And yeah I agree with the anticheat sentiment.
@chrome bay that would work in most instances, the problem is that these are short-matches that just start and end. It's not some persistent universe like Minecraft, imagine how clunky it would be if you had to set up a server before playing a street fighter game.

chrome bay
#

tbh I would just develop for both

#

HLL was developed only for dedicated servers and sometimes that makes testing things a real nightmare

#

Listen server won't even run

waxen quartz
#

@chrome bay HLL? Hell let loose?

#

and yea you might be right, if cheating becomes a problem then I can just pay for dedicated servers and it shouldn't be too hard to switch over to them. It still bugs me for 1v1s to add unnecessary ms though.

lucid vault
#

(I'm reposting this as the multiplayer channel is probably a better place for an answer)

#

I've been trying to solve this issue for a few days now without luck. Doesn't seem to be much documentation on it. Disabling replicate movement at runtime causes player's speed to change. Here are steps to reproduce the problem:
(4.23)

  1. Create FPS template (BP)
  2. Open the player character BP
  3. Add input node which calls set replicate movement passing in false
  4. Start game on default level with 2 players
  5. When you press the input key that you chose in step #3 (on the client), the player's movement will stop replicating as expected, but he will speed up super fast for some reason
    This issue does not happen if set replicate movement get's called on begin play. It seems to only happen when called during runtime after initializing with begin play
winged badger
#

probably because your acceleration got stuck

lucid vault
#

Hmm, wouldn't the character movement fix that locally?

#

Because it should control the characters acceleration

waxen quartz
#

Maybe disable replicate movement and code your own movement replication?

#

ah wait are you using cmc?

lucid vault
#

Yeah

#

I'm using cmc

#

I want to use the default replication because it handles the client side prediction well enough for low ping

#

I'm just trying to understand why I can't disable the player's replication without this happening

#

@winged badger If you disable movement replication when your velocity is 0, the glitch still happens. Which means the acceleration isn't getting stuck

waxen quartz
#

Does the player speed up on the server or on the client?

lucid vault
#

client

silent birch
#

Hi

#

I still have the same problem. No solution found

silent birch
#

Not solution

dark edge
#

For one-offs like playing a sound or spawning a particle, do you guys multicast the spawning of it or just replicate the actor?

silent birch
#

Me? @dark edge

zealous saffron
#

multicast @dark edge

#

don't replicate it

#

make it local

#

only try to replicate something if it affects the game and all clients need to know the latest information on it

#

SFX, FX, visual details should be client side and multicasted

worthy perch
#

SFX, FX, visual details should be client side and multicasted
Multicasted?

zealous saffron
#

if you're doing one off events or objects that are only going to be updated by events multicast them rather than replicate them.

worthy perch
#

Oh, makes sense. I think you meant should be client side **or** multicasted

zealous saffron
#

mast sails, etc are only going to be changed via damage or movement modes.

#

so a multicast event is called and the client updates their local copy.

#

same would apply for one off things like firing a gun/cannon/weapon, you'd create the FX & SFX locally from a multicast.

#

not really @worthy perch client side and multicasted

#

perhaps I should have said client side and the events to update them are fired from the server to a multicast.

#

so don't tell the server create a new SFX/FX and set it to replicate

#

tell the server to tell all the clients to create a new SFX/FX locally and have it not replicate.

meager spade
#

i have a ClientFXManager

#

which is local only client

zealous saffron
#

Smart

meager spade
#

which handles local FX stuff, every client has one

zealous saffron
#

What does it do specifically?

meager spade
#

i use gameplay cues, which is part of GAS

#

when i fire certain cues, if they are local only, then they wont be multicast out

#

the clientfxmanager intercepts them and just plays them local, bypassing the multicast. If it does need to be played to everyone, then its played locally on the client, and multicast out ignoring the client who spawned them, then on the client side, there clientfxmanager intercepts the cues and plays them

#

so its like we can limit what gets sent over network or what should be played locally

#

some cues should not be played for everyone

#

i dunno its just a system i came up with lol

#

clients handle the spawning of the FX themselves

#

based on a GameplayTag

silent birch
#

For the character of the game I also made a random spawn and it works but the problem is that for a player there are two characters who appear

#

I know where the problem comes from. That's because for the client there is the random spawn character that appears and the character put in the default pawn of the game mode. Apparently the default pawn character only appears where the client spawn not to another place

faint dock
grizzled stirrup
#

If you make an INITIAL_ONLY replicated variable and a client joins after the initial bunch has been sent out, will he receive the correct value?

#

The value I'm trying to replicate here is a score limit which is completely static past entering the game

#

But the clients need to know it to display it on the UI

#

Alternatively would it be more efficient to pack all of my state replicated properties into a single replicated struct? (containing 4 uint8's: ScoreLimit, CurrentRound, RedTeamScore, BlueTeamScore)

faint dock
#

it does as far as i know

grizzled stirrup
#

Thanks

silent birch
#

So but The video did not help me

faint dock
#

then i dont know how to help you

silent birch
#

So you do not understand what I mean? @faint dock

faint dock
#

you get 2 player pawns spawn at beginplay?

silent birch
#

Yes

faint dock
#

and you spawn 1 player random and 1 player does not spawn randome what you dont want right?

silent birch
#

Do you know the default pawn? @faint dock

faint dock
#

not sure what you mean

silent birch
#

Do you know the world settings? @faint dock

faint dock
#

which one

zealous saffron
#

Probably spawning a pawn twice

faint dock
#

i guess so too

#

but the video i sent should help there

#

he needs to override the playerspawning logic in the gamemode

silent birch
#

In unreal you have to choose the character that goes spawn and it is this character who spawn with the client which makes that two characters spawn the character who randomly spawn and the character who is designated for spawn by default

faint dock
#

like i said you can change all that logic in the gamemode

silent birch
#

How?

faint dock
#

watch the video

silent birch
#

OK I will try to look at it again @faint dock

faint dock
#

they do a randome spawn for the player i guess like you want it

#

but its for splitscreen so you have to think a little different

silent birch
#

The problem is only at the client not the server @faint dock

#

At the server that spawn well @faint dock

faint dock
#

i dont know how to help you could be 1000s of things that are wrong here watch the video they do it right

silent birch
#

When I do not designate the character who is going to spawn by default (in the game mode) the client does not take control on any actor, so at the customer's place it is unpossession @faint dock

faint dock
#

so the pawn spawns on the server and client but the client does not play the pawn?

#

pawn = character

silent birch
#

At the client nothing spawn (if I do not designate the character who will default spawn in the Gamemode) @faint dock

faint dock
#

sounds like the character is not replicated

#

i have to go gl

silent birch
#

OK

#

The character is replicate @faint dock

gleaming vector
#

stuff like bIsReplicated

#

this is good, but heads up to people updating

silent birch
#

I still have not solved my problem

fossil spoke
#

@gleaming vector Its actually about time they did that

silent birch
#

Finally the second character that appears always appears when I test the game in 1 players this second character spawn always and always in the same place But only when I appoint a player who goes spawn by the game mode

grizzled stirrup
#

Is there any obvious reason that this isn't replicating?

#
USTRUCT()
struct FMyMatchState
{
    GENERATED_BODY()

    UPROPERTY()
    uint8 ScoreLimit;
    uint8 CurrentRound;
    uint8 RedTeamScore;
    uint8 BlueTeamScore;

    FMyMatchState()
    {
        ScoreLimit = 0;
        CurrentRound = 0;
        RedTeamScore = 0;
        BlueTeamScore = 0;
    }
};
#
    UPROPERTY(Replicated, Transient)
    FMyMatchState TDMState;
worthy perch
#

Can you use a single UPROPERTY() to cover multiple properties?

grizzled stirrup
#

ahhhhhh that's it

#

thank you

#

Completely blanked on it

#

One side question, would it be more efficient to send one of these structs to each client via a client RPC once every round rather than having it replicated?

#

Seems like it would be more logical since these values don't change often

worthy perch
#

I would say no. At least, not meaningfully. This is a pretty small struct anyway, on a single class too.

grizzled stirrup
#

Cool thanks again for the help!

meager spade
#

no you cant

#

macro is for the line after it

#

thats the scope of it :/