#multiplayer

1 messages · Page 618 of 1

nimble sinew
#

click the dropdown by launch next to UE version you're using

#

it should be in options, check "Editor Symbols for debugging"

dawn nova
#

thank you very much!

nimble sinew
#

np i've been there

#

they do help a lot

dawn nova
#

Yeah I know what they do. I'm not sure why I didn't install them but I was hesitant to because I didn't think knowing the engine lines would help me in this case. But hey I might be proven wrong

nimble sinew
#

whenever you get to the point where you think theres the tiniest chance it could be a bug or a glitch in the engine, or even you misusing it, those will help lol

cosmic trail
#

they help, but it also helps other folks help you, since a lot here know the engine pretty well

dawn nova
#

Looks like it's just trying to get the AI class from the GlobalClassReplicationMapList or something before its present

cosmic trail
#

did u add the class to the rep graph?

dawn nova
#

Yes

#

The issue is that its looking too early

cosmic trail
#

to this is before the rep graph initializes?

dawn nova
#

Yes I need a way to delay my AI from even calling that RPC before initialization thats my issue

cosmic trail
#

oh then just set a flag for when the rep graph finishes initializing?

#

and check that flag before doing rep calls?

dawn nova
#

Like a bool on my replicationgraph you mean?

cosmic trail
#

something like that, many ways to do it probably

dawn nova
#

Yeah I get what you mean

cosmic trail
#

also u need to make sure both rep graphs are initialized, client/server I assume

#

nah actually u don't

dawn nova
#

I'm quite new to ReplicationGraph, in what method can I be sure its fully initialized?

cosmic trail
#

client won't care if u send down something that it doesn't know about

#

I don't think

#

Not entirely sure myself which function, I know that InitGlobalActorClassSettings builds the class stuff

dawn nova
#

Would any point after adding the class to the global rep class list suffice you think

#

I'll try that

#

Thanks for your help either way

calm monolith
#

hey my find session instantly fails both on steam and on the epic subsystem

dawn nova
#

If you turn logging to verbose for OnlineSubsystemSteam then you should be able to see detailed logs of what is actually going wrong, like maybe an error message from the steam service

lucid vault
#

Is there any way to get server travel working in PIE for all connected users? It would make iteration much faster

#

I have some features that persist across levels and I need to test them. But I have to build and deploy my dedicated server every time as server travel won't work in PIE

meager spade
#

no

#

you dont need to build and deploy a ded server to test

#

you can run ded server from command prompt

#

"I:\UnrealEngine\Engine\Binaries\Win64\UE4Editor.exe" "%CD%\Kaos.uproject" TestingLevel -server -log like this

#

clients can connect like: "I:\UnrealEngine\Engine\Binaries\Win64\UE4Editor.exe" "%CD%\Kaos.uproject" 127.0.0.1 -game -ResX=800 -ResY=900 -WinX=0 -WinY=20 -log

#

no need to deploy,build or cook

shadow arch
#

hey guys so quick question. How would you all implement a networked system for acts like in diablo?

#

so far the only idea i have is level streaming but i hear that's a bit janky multiplayer?

dawn nova
#

The thing that comes to mind is Level Streaming as well, you mean multiple players on the same map but in different sublevels correct? It will work in multiplayer but you have to work with StreamingLevel names to determine whats relevant to replicate to actors in which streaming level etc

hoary bloom
#

Not really a multiplayer question exactly, but is there any way to change the default match state? As far as I see, when a level is loaded, the state is always 'match in progress' but I'd like it to be 'ready to start match' on level load, as I want to have a 'pre-round' screen so to say

twin juniper
#

hi, wondered if anyone could help. I have a butterfly which moves in 3d, basically I spawn a 2d invisible mesh underneath it which uses 2d pathfinding, every tick in my butterfly blueprint I calculate the distance+direction this has moved and divide it by the tick interval to SET the velocity of the butterfly's character movement component, plus some z value which varies over time according to a timeline. My movement is fine and dandy. HOWEVER I am having no luck getting the rotation to work either in single or multiplayer, the capsule and mesh will face the same way no matter what direction I move in. The only success I had was using projectile movement instead of CMC and using 'rotation follows velocity' but this doesn't work in multiplayer (plus movement is choppy).

#

I am trying 'get rotation from Xvector' at the moment (my Xvector being the velocity I calculate on tick) along with 'use controller desired rotation', seems not to do anything. Have tried all sorts of combinations, including 'orient rotation to movement' (and not changing controller rotation on tick)

#

It's not that initial rotation needs to be adjusted, it's that there is no rotation of the capsule + mesh at all

twin juniper
#

Edit: eventually got it to work via 'set actor rotation', what the hell... thought that would be bad for replication.

round meadow
#

Hi
I have a bp of a weapon that spawns a bullet, which is another bp with a projectile movement, like the first person template.
It calculates the location of the bullet from the location of the muzzle (socket in the mesh). This works fine on the server, but for some reason it spawns under the character on the client. Does anyone know why?

glossy shuttle
#

Hello, I would like to ask if anybody knows about a good solution on how to wait for Actor to replicate to client before replicating another property to the same client from server.

For example. Suppose I have Actor A and Actor** B** and both are replicated.
A is spawned on server and he spawns** B**.
Then A will assign B **pointer **to its custom struct's property with custom replication.
In "pseudocode":

struct CustomStructType{
  Actor* pointer;
}
class A{
  CustomStructType customStruct;
}
A.customStruct.pointer = B;

Nothing in this struct is marked as UPROPERTY.

I need to wait for B to replicate to the client before the custom struct replicates.
If the struct replicates first, then it will point to null since the actors do not exist yet on the client.
And I do not want to mark anything in the struct as UPROPERTY since this is only simplification of the problem to its minimal form.
(in reality the pointer is in a TMap which cannot replicate by default)

SInce UE alredy has a mechanism for waiting for its UPROPERTY marked properties which hold pointers to Actors
I would like to leverage this mechanism.
Does anybody know how to do it, or where in the code could I find it?

crystal crag
#

This is the first time I have tried to run a dedicated server w/ separate process since UE 4.26 (using the editor) and I am getting the following exception:
[2021.02.14-18.27.02:863][ 0]LogStats: FPlatformStackWalk::StackWalkAndDump - 6.047 s
[2021.02.14-18.27.02:865][ 0]LogOutputDevice: Error: === Handled ensure: ===
[2021.02.14-18.27.02:866][ 0]LogOutputDevice: Error:
[2021.02.14-18.27.02:867][ 0]LogOutputDevice: Error: Ensure condition failed: !IsRunningGame() [File:C:/Source/GH_Repos/UE4/Engine/Source/Editor/MainFrame/Private/MainFrameModule.cpp] [Line: 514]
[2021.02.14-18.27.02:867][ 0]LogOutputDevice: Error: The MainFrame module should only be loaded when running the editor. Code that extends the editor, adds menu items, etc... should not run when running in -game mode or in a non-WITH_EDITOR build
[2021.02.14-18.27.02:868][ 0]LogOutputDevice: Error: Stack:
[2021.02.14-18.27.02:869][ 0]LogOutputDevice: Error: [Callstack] 0x00007ffb7fa1d3ab UE4Editor-Core-Win64-Debug.dll!FDebug::OptionallyLogFormattedEnsureMessageReturningFalseImpl() [C:\Source\GH_Repos\UE4\Engine\Source\Runtime\Core\Private\Misc\AssertionMacros.cpp:497]
[2021.02.14-18.27.02:869][ 0]LogOutputDevice: Error: [Callstack] 0x00007ffb3703352e UE4Editor-MainFrame-Win64-Debug.dll!<lambda_9a01b534919071e5a1ae147e2e310ab8>::operator()() [C:\Source\GH_Repos\UE4\Engine\Source\Editor\MainFrame\Private\MainFrameModule.cpp:514]

#

Has any one else encountered this?

#

I'm using Debug Editor if that helps

stoic acorn
#

I'm really struggling to understand why all clients UI won't update with my setup. I'm trying to show a 'player wins' screen for all players at the same time.

Here's what I'm doing to try and debug this:

  • Fire a Custom Event on my PlayerController on Keypress G which sets the visibility on an ESlate Visibility variable type and some other information variables. At the end I'm firing an Event Dispatcher
  • In my InformationHUD User Widget I'm triggering a custom event that is bound to the Event Dispatcher that sets the visibility of a Victory Message Panel.
#

It works but only for the server as you can see here (it even flip flops nicely). Any thoughts on what I'm doing wrong? (am I even doing anything right?) What do I need to do to get this to trigger for all connected clients?

kindred widget
#

@stoic acorn Always remember that only Actors can replicate. The only default object besides them that can is an ActorComponent, but that also uses it's actor to do that replication. Widgets cannot replicate or RPC.

#

Which looking closer wouldn't change your setup really.

#

Realistically, I'd probably just put a replicated variable somewhere like GameState. That or a multicast if you don't care about state. And call that when the match ends with some information like the winning player that the local client can add a widget to screen and populate.

stoic acorn
#

hmm. I've been bumbling around in the dark with this for a few days now with zero success. How would you go about setting that up.. What I'm actually trying to do is...

  • If the final human player crosses a gate (finish line) it triggers the Player Wins screen. How I'm doing this is with an ExitGate Actor that sets a player crossing variable on overlap .. Which then triggers a custom event on my Game Mode to check who has won with the rules that I've set. If valid it will trigger this Update Information HUD screen.
kindred widget
#

Do you want it to show up at the same time for all clients, or individually based on their own progress?

stoic acorn
#

All at the same time.. It's essentially the end of the match

#

either that 1 player escapes, or they are caught and the other team wins

#

I can't even contemplate making a leaderboard screen after failing to get a simple win screen working

kindred widget
#

Probably GameState then, like I said. You can easily just pass a PlayerState pointer through a Multicast RPC, or set a PlayerState pointer as a repnotify variable. Each client can use that pointer to get info from the passed playerstate to populate a widget and add it to each client's screen.

#

Winner crosses gate, GameMode confirms, tells server's GameState who won, GameState RPCs or sets the Repnotify variable, each client adds their widgets to screen with the winner's name.

stoic acorn
#

ok.. so I'll attempt to give that a go. Repnotify seems to be a logical choice right?

#

The bit I'm lost with is "each client adds their widgets to screen with the winner's name."

kindred widget
#

You could do either. I like Replication for important things. I tend to leave Multicasts for simpler effects that don't really need to persist. Ending the game feels kind of important so I'd probably do a repnotify.

stoic acorn
#

"each client adds their widgets to screen with the winner's name." how would you go about doing this bit? I mean what method?

#

I thought I was onto a winner with the Event Dispatcher

crystal crag
#

Before attempting to use Debug Server, do you first have to cook your project?

kindred widget
#

@stoic acorn If you do something like this in your GameState and a Widget...

#

Something like this for the OnREP for the WinnerOfGame, which would be a PlayerState type pointer.

#

Then all you need to do is GetGameState->CastToYourGameState->DisplayEndOfGameScreen with a valid playerstate for the winner.

#

from where ever you decide who the winner was on the server.

#

Alternatively, you could also make the widget get the local gamestate to get the winning player on it's OnInitialize to avoid a custom event. Either way.

stoic acorn
#

Ok thanks for all the advice Authaer. I'll give this a go. The hardest part for me is knowing where to put the logic.

summer tide
#

Any idea why steam won't work in UE4.26 but used to work in UE4.25?

summer tide
#

How can I debug it? Any help?

crystal crag
#

Are you using pre-built binaries or source build?

summer tide
#

Bin ue4.26 w/ ADvancedSession Plugin

#

I got it working. Thanks anyway

pallid canyon
#

I'm at my wits end with oculus

#

I create a moderated room, I get a room ID back

#

oculus documentation says to use "Find Moderated Sessions" to find the server and it will return a session to join

#

(makes no sense cuz there's no session creation anywhere, it's an http post to create the room)

#

so join session "succeeds" and adds the oculus ID to the room, but fails to join the session on the server, server doesnt see any communication and the url that oculus uses is the same as the client id that is attempting to join (is that by design?).

#

UEngine::BroadcastNetworkFailure: FailureType = ConnectionTimeout, ErrorString = UNetConnection::Tick: Connection TIMED OUT. Closing connection.. Elapsed: 60.01, Real: 60.00, Good: 60.00, DriverTime: 60.01, Threshold: 60.00, [UNetConnection] RemoteAddr: 3716067065179764.oculus, Name: OculusNetConnection_2147482506, Driver: PendingNetDriver OculusNetDriver_2147482507, IsServer: NO, PC: NULL, Owner: NULL, UniqueId: INVALID, Driver = PendingNetDriver OculusNetDriver_2147482507

#

Is there anyone on this wonderful discord that has literally any idea on how to deal with moderated oculus servers

barren canyon
#

(Noob) How do I get an owning connection for actor?

swift kelp
#

How do you think people do timers in a texas hold`em game and make it smooth?
So in my situation, the server tells the client it's your move, then the client starts its clock, but before the client's clock is finished, the server already told the next player it is there turn.

#

I figure I could have the client send a probe to the server saying the clock is done, but then a hacker could probably prevent that probe from going through giving them-self a lot of extra time.

vivid seal
#

do the timer on the server and just replicate the end time of the timer to the client.

swift kelp
#

TheGameState.GetServerWorldTimeSeconds()
Found out I can do that

#

so what you said, but there is a function for it

sudden lagoon
#

Does anyone know how to make a login system like pubg or any AAA quality title . Where we can create a game account or we can login through google or Facebook

twin juniper
#

Try YouTube for some tutorials, there should be some online login tutorials for unreal.

sudden lagoon
#

@round meadow forget about my question I am only 17 and do not have credit card .

#

just I think I will use game account login

thin stratus
dusky echo
#

@thin stratus Hi Cedric, ich will mich persönlich bei dir bedanken, für die NetworkCompendium die du öffentlich zugänglich gemacht hast! Ohne die wäre alles viel viel schwieriger geworden 😅 🙏
Liebe Grüße aus der Nachbarstadt MG 😋

thin stratus
#

No problem, feel free to text me this via DM if you want to write in German though. :P

#

@dusky echo

dusky echo
#

Ups sry 😬 🙈

round meadow
#

hi
I am spawning a bullet from the bp of the weapon.
When I play in standalone, everything works fine, but when I play as client, the bullet does not work.
I have done some debugging and it turns out that the socket location of the weapon is different on the server and on the client.
Does anyone know why?

kindred widget
#

@round meadow Hard to say without seeing your spawning logic. Initial assumption is that you're trying to get a socket location from an invalid mesh somewhere, which is returning a default value rather than the expected one.

kindred widget
#

@round meadow Well. That looks fine. Unfortunately you're attempting something that is a bit complex. Multiplayer games don't really spawn actors that often for fast moving projectiles. You are right that the socket locations would be in different places. How you fix that really depends. You'll find that a lot of games will spawn a local version for the client to use and that version will decide of the client hit anything and have that client RPC to server to have the server verify the hit. Each time the client fires, the server will have all other clients play an approximate visual that will just exist for nothing more than cosmetics. If you do things like what you're doing now, the issues are that everything only ever happens on the server, and that will feel bad for clients. For instance, if you spawn that actor, it might not even spawn at the same place on the client. If it isn't considered for replication until the next frame, it could be several hundred units in front of the client before it actually spawns on their screen. Some projectiles don't even get replicated because they can spawn and die so fast on the server that they don't get replicated.

#

My initial recommendation would be to start with some hitscan stuff that are line traces. Make a weapon that behaves well like that between it's functioning and visuals, and then complicate it with actual projectiles.

round meadow
kindred widget
#

@round meadow That definitely looks like your socket is returning the location of your root. Let me look at that function really quick.

round meadow
#

@kindred widget what function?

kindred widget
#

The GetSocketLocation function. Which has now just baffled me.

meager spade
#

@round meadow dedicated server?

#

if so animations don't play on dedicated server by default, so your characters bones/sockets do no match the client

kindred widget
#

How does that function even work? It takes in a SocketName and doesn't even use it?

#
FTransform USceneComponent::GetSocketTransform(FName SocketName, ERelativeTransformSpace TransformSpace) const
{
    switch(TransformSpace)
    {
        case RTS_Actor:
        {
            return GetComponentTransform().GetRelativeTransform( GetOwner()->GetTransform() );
            break;
        }
        case RTS_Component:
        case RTS_ParentBoneSpace:
        {
            return FTransform::Identity;
        }
        default:
        {
            return GetComponentTransform();
        }
    }
}```
meager spade
#

thats scenecomp

kindred widget
#

Oh right. Dur. Inheritance.

meager spade
#
{
    QUICK_SCOPE_CYCLE_COUNTER(USkinnedMeshComponent_GetSocketTransform);

    FTransform OutSocketTransform = GetComponentTransform();

    if (InSocketName != NAME_None)
    {
        int32 SocketBoneIndex;
        FTransform SocketLocalTransform;
        USkeletalMeshSocket const* const Socket = GetSocketInfoByName(InSocketName, SocketLocalTransform, SocketBoneIndex);```
round meadow
meager spade
#

@round meadow turn on this option

#

if it is not on your skeletal mesh

round meadow
#

it was already set like that

meager spade
#

on the character mesh?

round meadow
#

Nope, not in the character
it works : )
wow it was so simple

#

thank you very much

meager spade
#

np

umbral granite
kindred widget
#

@late cedar I would consider posting that question in either #mobile or #packaging. You'll likely get better answers there since your question is not very multiplayer related.

regal sand
#

How would I store and use variables for two bp sidescroller characters ("Score, etc.")?

#

Like to have each player object have its own stats?; How would I make the OOP?

#

Local multiplayer btw

silent valley
#

Each player has their own PlayerState - override that and store your data there

regal sand
#

Ok cool

kindred widget
#

I'm a bit confused by the network profiler. Is this a known bug issue or is there something I'm missing? I have this NewVar0 array that I'm adding one entry to on keypress on the serverplayer. That is each one of the 11 large spikes. Each of those when checked individually say that 13 bytes was sent. Which is expected, it's a struct of one bool and three ints. Yet when I select the whole area, it says 134 bytes... 11*13=143.

grizzled stirrup
#

In the shootergame weapon class, AActor::Destroyed is overridden and after the super call, there's a function that stops cosmetic FX playing and deactivates + sets all particle system components to null. My question is why is this even here as if the weapon is being destroyed, wouldn't it naturally stop cosmetic FX by no longer existing?

thin stratus
#

@kindred widget You might want to check Unreal Insights and see if they have Network profiling. That might give you better info

fallow quail
#

Hi everyone! I'm trying to use OnlineSubsystems to create and join sessions in a multiplayer game. So far, it works well in LAN. Find session returns the game correctly and I can join from another client.

To enable WAN playing, I port forwarded my PC so that other players can join. When they use the command open X.X.X.X (my public IP address), their player is spawned in the game correctly. However, when we try it through Find Session and Join Session, the Find Session returns an empty array of sessions. How can the sessions be discovered in WAN?

thin stratus
#

The NULL subsystem just pushes out a "Are you hosting?" question via Broadcast IP.
I haven't really dealt with WANs, so not sure that's supported?

sweet marsh
#

Hey guys, quick one, any idea why when launching an item the client throws the item twice as far

#
    {
        // Don't allow the item to collide with the character or environment
        R_bAllowPhysicsInteraction = true;

        // Call the function manually as the server doesn't do this on rep notifies
        On_RepModifyItemPhysics();

        // The vector to launch the object with
        FVector LaunchObject;

        // If we are just given a normalized vector (direction with no magnitude) then multiply by Blueprint values
        if (LaunchDirection.IsNormalized())
        {
            LaunchObject = FVector(LaunchDirection.X * LaunchForce, LaunchDirection.Y * LaunchForce, LaunchForceZ) * LaunchForceMultiplier;
        }
        else // We are given the full trajectory
        {
            LaunchObject = LaunchDirection;
        }

        DetachFromActor(FDetachmentTransformRules::KeepWorldTransform);
        StaticMeshComp->AddImpulse(LaunchObject * StaticMeshComp->GetMass());
    }```
thin stratus
#

Uff, Physics and Multiplayer

#

It's not deterministic. Shouldn't be twice as far, but will probably never be the same

#

Compare the values and see what both sides do

#

Also, you are only doing this on Authority anyway?

sweet marsh
#

That's fine, not too fussed about it not being perfect, auto corrections will do this time. It'll need rewriting when unreal handles networked physics anyway

#

yeah so its an item that it owned by the server

thin stratus
#

And?

sweet marsh
#

sorry, it's owned by the server, and the throw is triggered by a gameplay ability on the parent class

fallow quail
sweet marsh
#

then this method fires after running the super version of the function

thin stratus
thin stratus
#

SubsystemNULL only does the Broadcast stuff.
Other Subsystems, like Steam, ask the MasterServer for a list of registered/created Sessions.

sweet marsh
#

Ok think i found the problem, in order to run server commands the ownership is handed over to the character carrying it, however this was not reset to null so i guess when the function above was firing both client and server were firing it

thin stratus
#

"Server commands"? Try to stick to terms that are generally used :P

#

Do you mean ServerRPCs?

sweet marsh
#

Apologies, yes ServerRPC

thin stratus
#

Can totally be that there is a mixup if you manage to not set the Owner correctly

#

Theoretically you should be aware of where you are calling a function on

#

e.g. Server vs Client

sweet marsh
#

yeah i just tested it with setting the owner to null and it worked correctly

fallow quail
sweet marsh
#

Thanks @thin stratus you triggered the thought to check that when you mentioned who it was owned by 🙂

dense ocean
#

I'm struggling with the basics of replication in blueprint. How can I destroy an actor on all clients & server?

steel vault
dense ocean
hybrid zodiac
#

HI all, got a bit of a challenge. When my multiplayer round restarts, I want it to clean up the level of dead bodies, dropped items and so on. I'm handling this with ActorItr which is fine, but what I'm having trouble with is cleaning up particle effects like lingering smoke and so on

#

I can use an ObjectItr to grab every UParticleSystemComponent and destroy it, but then it would destroy any emitters that are placed as part of the level

#

Is there a way to differentiate between particle systems that were placed in the map and those that were spawned dynamically?

steel vault
#

Yea, tag them.

kindred widget
#

You could always subclass these things that have extra particles and such and just override OnReset and call a LevelReset from game mode.

hybrid zodiac
#

@steel vault Ah good shout, forgot about tagging. How do I do that? Looking at UParticleSystemComponent but don't see an "add tag" function. Do I need to call ComponentTags and add it manually?

silent valley
#

Do they belong to an Actor? Actors have bNetStatic to indicate if they were part of a level or dynamically spawned

steel vault
#

^ Even better, if that works.

hybrid zodiac
#

@silent valley Nope, they're spawned using UGameplayStatics::SpawnEmitterAtLocation, so not attached to an actor

#

I'll try the tag

steel vault
#

There is actor tag and component tag

kindred widget
#

That still spawns an actor. Components cannot exist outside of actors.

dense ocean
#

What would be the proper way to replicate SetActorLocation?

steel vault
dense ocean
#

Thank you, but that is checked. Its a Character I'm trying to move

steel vault
#

Oh, well then if it's a character you need to use the Character Movement Component.

#

Although, I'm pretty sure it has replicate movement checked so just setting the character's position should work I believe?

dense ocean
#

On the server all clients move, but not on their client

#

And i cant find any events related to position in the Character Movement Component

#

I have an event being run on the Server to loop through each player controller, and tell their pawn to move

steel vault
#

Move as in set their location? Or move as in you are calling AddMovementInput

dense ocean
#

Set their location

round star
#

I think this is a pretty simple question for anyone experienced in networking in UE4. ...my understanding is that replicating this entire function is pointless (this runs from a dedicated sever)...what's important is what I circled in red..the end result of the function..the actors location and scale etc...this is what needs to be in sync with everyone..so thats what needs to be replicated...correct or no?

steel vault
dense ocean
#

It seems obvious why I'm having an issue - My event is set as Run on Server, so it makes sense why it only happens on the Server. But i made a custom event (Multicast) to move the actors that is called from this server function also, and that doesn't set the location on client either which has me confused

steel vault
#

You don't need to multicast the movement of a replicated actor.

#

If you set it on the server, it moves for everyone else.

round star
#

Ah I see

steel vault
#

You're not doing the same move a bunch of times separately. Replication of that actor if its movement is replicated means it will change positions after you do it once on the server.

round star
#

yea for sure multicast here would be terribad

#

setting values on server and then the result is replicated down to everyone else

steel vault
#

Yes.

dense ocean
steel vault
#

You can test this by creating an actor, setting it to replicate, setting movement replicated, then set its position with HasAuthority()

dense ocean
#

Should this event work? This is what I have, and it doesn't

#

executed from the Gamemode class

kindred widget
#

Don't use sequences like that. There is no promise that your shuffle even finishes before the loop starts. That should be a straight execution line.

dense ocean
#

Oh thank you, I thought it would wait for the first line to finish. I'll change it

#

Also my StartGame event is called from a button press in a widget, that I'm pressing from the server

kindred widget
#

Most times it won't pose a problem. But I'd hate the be the person who had to debug it when it is. Just safer to use them when you have two completely differing things that need to happen on the same event.

dense ocean
#

Thank you, that makes sense

steel vault
#

Just so you know, I use set actor location on my Character and it works properly.

dense ocean
#

Hmmmm

kindred widget
#

It is odd that it isn't working though. Presuming the pawns are replicated, and your controllers are actually possessing pawns at the moment, that should work fine if called on server.

dense ocean
#

Yep those predicates are true but still nothing

kindred widget
#

Worth a debug to remove the spawnpoints, and just put in like 0,0,10000 and see if they all move into the sky at the center of the map.

#

Then again, even if that was invalid it would still be 0,0,0, which would still move them.

dense ocean
#

I'll give it a shot to see if they move at all

steel vault
#

Yes, try taking out loop iteration.

#

Simple single set location

#

Then worry about your loop being the issue

kindred widget
#

@dense ocean Wait a minute. What blueprint is that event in?

dense ocean
#

my Gamemode

#

I have no idea what blueprints replicated events are even capable of being fired within

#

from what i understand they just need a net owner

kindred widget
#

The RunOnServer is unnecessary. And your Array of Controllers is also not going to work. GameMode is only on server, and even if it could replicate that array of controllers, only one of them would ever be valid on any client. You're sure this event is even running from your widget click?

dense ocean
#

Okay so breaking the Location pin caused both characters to move

#

And i printed out the controllers on all clients, it seems to work. And yes my widget click is the only thing that calls the event

steel vault
#

Meaning the location is incorrect? What location pin

dense ocean
#

I'm now realizing something

#

I should replicate the Spawnpoints array, shouldn't I?

steel vault
#

Not if it's in gamemode on the server

dense ocean
#

and @steel vault I broke the New Location pin on the set location node

steel vault
#

You can let the server determine where the locations are and set the locations

dense ocean
#

Oh okay so I'm not sure, yes its on the server in the gamemode

kindred widget
#

Nothing needs replicated. Since you're calling this on the server machine inside of GameMode, there's no extra networking code required besides the pawn being replicated.

steel vault
#

Yea if you have the pawn and you're on the server calling set location you're good to go

#

You just need to make sure your locations are correct

#

Put in a fake one like Authaer said

dense ocean
#

I did put a fake location in

steel vault
#

And it moved?

dense ocean
#

Yes

steel vault
#

Ok.. so there's your issue

dense ocean
#

When it's just 0,0,0 on the node, all works. Why would plugging in the get(0) from the Spawnpoint array cause the issue?

kindred widget
#

Technically it shouldn't. Unless your pawn is already at that location.

steel vault
#

Removing something from the array isn't going to change your 0 value in the array

#

Oh you're removing index 0

#

I see

dense ocean
#

Yes all elements should decrement their index

kindred widget
#

Even if the pointer was invalid, that GetActorLocation should return 0,0,0, shouldn't it?

dense ocean
#

Or at least throw an error, which it did not

#

And the pointer has to be valid because on the server, everything is perfect

steel vault
#

You need to put a print in there for get location

#

And see what it's printing out each time

dense ocean
#

Okay I'll try

#

The print returns the correct locations

#

However it's only printing on the server as it's run in the gamemode, and my issue is on the client. Not sure if that matters

steel vault
#

It should only be on server since gamemode only exists on the server

#

Setting the actor location on server is what you want

#

Check is valid on the pawn?

dense ocean
#

Update, when i set the client to hidden in game, then set it back to visible, its location updates to where it is on the server (where it should be)

steel vault
#

Might be possible your array of player controllers is empty or less than you think

umbral granite
#

I can't even use the Steam SubSystem, when I package it it doesn't detect it and when I run it in other computers they can't join sessions

dense ocean
#

the array is good i did many print debugs for that

steel vault
#

Trying to set it too soon

kindred widget
#

But he already said splitting the location and setting it to like 0,0,0 works.

dense ocean
#

Yeah so the array is good

#

im not sure why hiding then revealing the actor puts it where it should be

steel vault
#

Hmm yea I dunno then. Sounds like everything should be working.

kindred widget
#

It's worth asking, does moving that pawn on that client with like normal controls after calling this function make it move to that point?

dense ocean
#

It doesn't, however, i have these loot boxes that give an item after coliding. After I walk into one with the client, it immediately moves to the desired point

kindred widget
#

So running into the boxes moves it to the start point that the function should have set it at? O.o

dense ocean
#

Yes

#

almost as if it recognizes the client should've moved

kindred widget
#

Are you doing a lot of startup replication? Is it at all possible you're saturated or over the upload/download limit?

dense ocean
#

Definitely not

#

Pretty much a new project

#

I think the answer is somewhere within the fact that the server puts the actor at the right location, but the client wont go there until triggering my overlap box, which calls another replicated event

kindred widget
#

Characters replicate so often for their movement that it should update immediately if that was the case though. Even moving to the edge of the correction radius should do it, which is fairly small by default.

dense ocean
#

I'm not sure I'm very stumped. I'm not sure what Relevancy even is.. could this be apart of it?

#

Okay so i was wrong about the loot boxes

#

It's JUMPING that puts the client at the correct location

steel vault
#

Tick teleport on for the hell of it

dense ocean
#

Nothing

#

would it matter that i'm using ue 4.24?

steel vault
#

I doubt it

dense ocean
#

Alright, I appreciate the both of your efforts either way very much. I learned a lot hopefully someone ran into the same problem and could give some insight

#

the thing is I can't use servertravel in PIE so i cant get to that level

loud onyx
#

hey question, if I wanted to be able to use both Steam and LAN subsystems in my game, how would I allow this? I can use one or the other by specifying in in the .ini, but what about both? A launch parameter would be the best solution, but I don't know how this is done.

lost inlet
#

if you want to use the NULL online subsystem, then just use IOnlineSubsystem::Get("Null") instead of the Steam one when in LAN mode

summer tide
lost inlet
#

also helps to know where you're spawning this widget too

summer tide
#

I have a custom component in my character.

#

I'm doing that in my component. It used to work and works in standalone but not on 2 separate PC over steam

lost inlet
#

is there a reason you didn't do something like subclass AHUD instead?

summer tide
#

no

twin juniper
#

Hey...i have some questions about Listen severs. Are there some documentation?

summer tide
lost inlet
#

emphasis on a solution, yes

#

since we use it as a general purpose way of managing UMG widgets

severe widget
#

why then, do you GetPlayerController(0) ?

#

Don't use GetPlayerController(integer) when you have better context!

#

Not sure that will fix your problem, but it definitely will cause a bug somewhere if you ignore your context and GetPlayerController

open quail
#

is there a way to get your current online subsystem? basically i want to know if the game went into it's fallback (NULL) online subsystem

steel vault
open quail
#

Thanks!

summer tide
#

@severe widget So I narrowed down my issue. The host's HUD get's removed when the clients joins the level. Any idea what to debug?

severe widget
#

anything and everything that ever removes a widget

#

would be my starting point

summer tide
#

Sorry IDK exactly if it removed it but the host's character event begin play gets trigger again when client joins

#

So I see the HUD for a sec until the client joins then it disappears

twilit stump
summer tide
#

On Possessed even doesn't exist in character BP

summer tide
thin stratus
#

Well you have to realize a few things.

  1. BeginPlay gets called on everyone who has an instance of that Actor. So if you aren't limiting it it will call on everyone who's currently in the game. At least for classes like Characters.

  2. BeginPlay is too early to perform any owner related things because on BeginPlay, no one is controlling the Character yet. You can't perform rpcs or check if locally controlled.
    That's why they are suggesting OnPossessed to you as that would allow to send a client RPC to show the UI.

summer tide
#

I am trying that right now but it was working in ue4.25 before but not in ue4.26 even-though I have changed many other things.

summer tide
thin stratus
#

Hm not sure then. The whole "UI for the player alone" thing is usually pretty straight forward.

In BP
ACharacter -> OnPossessed -> ClientRPC -> ShowUI
In C++
ACharacter -> OnRep_Controller -> IsLocallyController -> ShowUI

In BP/C++
APlayerController -> BeginPlay -> IsLocalPlayerController -> ShowUI

In BP/C++
AHud -> BeginPlay -> ShowUI

#

And that's just the very basic options you have.

summer tide
#

It shows my HUD until client joins as I mentioned before.

thin stratus
#

Yeah, but that's your code doing it

#

There is nothing in the examples I gave that would remove the Server's UI when the Client joins

#

So you are doing something wrong somewhere.

#

Maybe show us your code

#

And not only "What is called." but also "Where.", so where it starts etc.

#

Somewhere you must be removing the UI

twilit stump
#

@thin stratus is rpc needed? Doesn’t OnPossess trigger on Autonomous Proxy?

thin stratus
#

Only triggers on the Server afaik

#

And you have no access to the OnRep in BPs..

twilit stump
#

Cause your HUD definitely gets destroyed when traveling maps

summer tide
#

No - From lobby both host and client travels to the main level. the Host spawns first and sees the HUD. After that the client spawns and that's when host loses his HUD. Strange.

lost inlet
#

AHUD subclass is really the easiest

summer tide
#

What do you mean? Create a child of my HUD

lost inlet
#

"HUD" is a class, in our game it manages UMG widgets on the screen

#

works just fine in multiplayer

summer tide
#

It seems it gets removed from the viewport. strange

summer tide
lost inlet
#

you've already been told multiple times

#

it's an appropriate manager for spawning UI

summer tide
#

I'm using BP. I didn't understand then

lost inlet
#

our implementation is C++ but it's not impossible to do it from BP

summer tide
#

the issue is that I have to pass components info to my main widget which i called InvHUD. SO I don't think i can do that from AHUD

lost inlet
#

it needs an owning player

#

and when the HUD is created, you might not even have possession of a pawn yet

#

that's where you make things event driven

kindred widget
#

@summer tide One of the great things about using the AHUD class for widgets like Swires said, is that only one exists on a client at a time. It's a nice place for UI, specially since anything can get a reference to it very easily via GetPlayerController0->GetHUD->CastToMyHUDClass. You can set up events easily in there that add or remove widgets from screen and keep all of your widget logic in one singular place, and simply let other objects that need to affect UI get and use the AHUD to do it rather than having to open up twenty different classes where you're Creating and adding widgets to screen to track down bugs like this.

summer tide
#

Now if I include my custom AHUD in my level gamemode, it should load it

#

Unless char cast fails

#

And it does fails - cast fails

#

Maybe I can create an event here then call that from my controller

kindred widget
#

You can also do it in the Pawn's Beginplay behind IsLocallyControlled. Then you can also use the same event to update it if you ever respawn the character. Custom event in HUD that gets called and passes in a character reference. If the widget isn't created, create it and add it to screen. If it is created, set new variables and update the widget. Then Character's Beginplay can check if it's locally controlled, if yes, call that event with a self input.

summer tide
#

SO currenly I have a widget container with all of the widgets in it such as health, stamina, time, etc.

lost inlet
#

you might not have a valid pawn at this stage

#

it's a bad idea to require components to be passed to the HUD creation anyway

summer tide
#

I was creating my main widget from my player's custom component . So let me try the new solution to see what causing the issue.

lost inlet
#

well you were told that hours ago, which was that you were using GetPlayerController(0)

summer tide
#

I had a ref to my character in that component, then I tried using the ref as well. Both works it's only when the client joins and host loses his main widgets. So let me try AHUD now.

thin stratus
#

You can also do it in the Pawn's Beginplay behind IsLocallyControlled.
No.

#

Pawn's aren't controlled on BeginPlay

#

You spawn them, they call BeginPlay, you possess them.

#

That's why you use the PlayerController or HUD for your UI and if it really has to depend on the Character, then you use OnPossessed with an RPC or OnRep_Controller if you have access to C++.

kindred widget
#

That's fair. I'm used to the game start version rather than respawning. Pawn is already controlled before beginplay is called, but I hadn't considered that would be different if you did that in the middle of a game.

steep terrace
kindred widget
#

@steep terrace Widgets can't be replicated. So making a replicated pointer to one will return invalid on another machine. And checking for authority right after a server event isn't worth it. It'll only run on the server.

thin stratus
#

@steep terrace

  1. Don't mark Widget Refs as Replicated, they "can't" replicate and they shouldn't.
  2. Mark your HP Variable as "OnRep" and call the Widget's update function in the OnRep
steep terrace
#

It work!! Thx 😆

thin stratus
#

Also, the ServerRPC is not really what you want. This would mean you update Health if a Client says so

steep terrace
#

Step in my mind :

  1. player shoot a bullet
  2. Monster damage and reduce HP in Server
  3. After Server get the updated HP , It use
    ServerRPC to send the updated HP to all Client?
steep terrace
thin stratus
#

Well, the Server RPC would mean you let a Client tell the Server to execute the code

#

HP and Damage should never need an RPC from Client to Server

vague spruce
#

i realize that this is a newbie question, so i apologize. i just set up extremely basic gameplay for my game and i just turned on dedicated server. after fixing the possession issues, i'm now faced with this problem:

  • my character is t posing, so no animations are playing at all. i'm unsure if the anim blueprint is even playing whatsoever
  • the player controller is receiving inputs, but the movement is not replicating to the server

can anyone point me in the right direction? i realize i have to replicate the character (and i'm replicating the actual actor itself) but i obviously need to do more

#

wait, i already see a problem 🙂

steep terrace
thin stratus
#

The Client should tell the Server about the performed input.
E.g. if you have a Gun and fire with Left Mouse Button, then the Client should only tell the Server about it wanting to fire the weapon.
The Server can then check if the Gun can be fired, fire the gun and perform the damage stuff.

vague spruce
#

getting this error in my logs:

LogActor: Warning: SetReplicates called on non-initialized actor BP_PlayerBase_C_0. Directly setting bReplicates is the correct procedure for pre-init actors.
steep terrace
thin stratus
#

Yeah, in very simple words :P

thin stratus
#

Started with 4.26 iirc

vague spruce
thin stratus
#

ConstructionScript?

vague spruce
thin stratus
#

Might be worth breakpointing SetReplicates and seeing where it gets called from (callstack)

vague spruce
#

happens during APawn::PossessedBy

#

basically, my actor's bActorInitialized is equal to false when my player controller decides to possess

chrome bay
#

Sounds like it hasn't been fully spawned

vague spruce
#

i'm just wondering why it's doing that. not sure why the order of operations is wrong here. should i not be using a Player Start actor?

chrome bay
#

Are you just using the regular engines' method of spawning pawns or have you changed it to do something custom?

vague spruce
#

no custom logic

chrome bay
#

That warning being printed during possession is a bug in 4.26

vague spruce
#

so it's just a bug

chrome bay
#

The problem is, calling SetReplicates() from the constructor causes actors to be added to ReplicationGraph/NetDriver with the incorrect settings, because they haven't been loaded yet. I suggested a better fix on UDN which was to just assert if it was called during the constructor, but apparently they went with a different fix that just causes warnings to be printed non stop.

#

That and it doesn't really "fix" anything, unless you happen to be looking for warnings in the log.

#

Might PR a better fix because it's annoying as hell tbh

vague spruce
chrome bay
#

I mean there could be, but it sounds like something else is happening in your case. Notably because you don't have any animations and such.

vague spruce
#

i was wrong, there ARE animations

#

my problem is with the master pose component

chrome bay
#

Ah yes, you need to reinitialize Master/Slave quite often

vague spruce
#

i'm diving into networking now... i can tell this is gonna be fun 🙂

chrome bay
#

If you've possessed the character, all you need to do is call the "AddMovementInput" functions, and it's built-in networking will handle the rest.

vague spruce
#

i'm using SimpleMoveToLocation and i'm pretty sure that doesn't work with networking

chrome bay
#

Yeah that definitely won't work

vague spruce
#

christ

chrome bay
#

If you want the pawn the pathfind to different locations (i.e. point-and-click style) then you have to RPC the desired location to the Server, and the Server does all the movement.

#

But you probably also shouldn't possess it in that case

kindred widget
#

Are you supposed to use SetReplicates() in the constructor? I just do bReplicates = true; which works fine.

vague spruce
chrome bay
#

If you make any changes to the mesh, you need to reset SetMasterPoseComponent

kindred widget
#

Kay. I did something right this week!

chrome bay
#

Also MasterPoseComponent isn't serialized IIRC, so you probably need to call it around BeginPlay time too (or PostInitComponents in CPP)

vague spruce
#

yea, i just put my blueprint "Refresh" function on tick and it's working

#

so definitely i just need to figure out a better way of doing this

chrome bay
#

BeginPlay should be enough in BP, or anytime you change the animation/mesh asset itself

#

Also be aware slave components don't/can't have any collision

#

So the master has to cover for it

#

If you want collision you gotta use the anim-graph 'copy pose' stuff but that's much less ideal to setup

vague spruce
#

if i can just figure out how to set up master pose component from cpp i'll be gucci

#

because i know exactly where i'm setting up the slave components

chrome bay
#

We do it once in PostInitializeComponents:
HeadMesh->SetMasterPoseComponent(GetMesh());

vague spruce
#

well jeez that's easy

#

let me try that

#

that's funny, i also use the head mesh as the master pose component

#

i thought i was the only crazy one doing that

#

the head mesh basically has an invisible body (just the head) but it has the skeleton

chrome bay
#

to clarify it's the body that's the master, not the head

#

head is slave to master

vague spruce
#

ooooooooooooooo

chrome bay
#

If you wanted head to be master, you'd have it the other way around

vague spruce
#

yep, got it

#

lets see if it works

chrome bay
#

But also "because characters", and the way the character movement interacts with the mesh, you probs want the main mesh to be the master

#

Just because CMC sometimes ticks the pose manually so that it matches up with movement

vague spruce
#

hahahahah it freaking worked

#

thank you

#

so much easier

#

i can remove entire sections of my code and blueprint now

chrome bay
#

😄

vague spruce
#

cool, one bug down

#

the next thing im gonna set up is an RPC to the server

#

letting the server know that we movin bruh

#

so i want to let the server know of the destination that my character wants to move (it's basically just an FVector in the world). am i right to assume that i'll need to keep a property in my player controller that only lives on the server, and then i set up a UFUNCTION(Server) function to change that property?

rapid bronze
#

Hello everyone!

I have a little question regarding OnPostLogin in GameMode

I basically have set up that OnPostLogin players get registered in a Database and it needs to wait for the player to load for some Player Controller Initialization based around the GameMode logic

Here's my wonder
If 2 players join at about the same time, what will OnPostLogin spit out from the NewPlayer if the first player is not loaded yet for example?
I've experienced for example only the last player joining getting proper initialization, any way around it?
Perhaps a loading Queue?

Edit: I may have F up some of my logic, testing new stuff now
Edit 2: Solved

vague spruce
#

ah crap is it not possible to replicate TOptional? 😦

chrome bay
#

not possible indeed 😄

vague spruce
#

😦

chrome bay
#

TArray is the only template type replication supports

vague spruce
#

so i need the property to only live on the server. i guess that's just not possible? it would be of type TOptional, but it doesn't need to get replicated to the client

#

technically, only the movement itself needs to get replicated

#

and the movement is being performed by the movement component

vague spruce
#

YES I'M MOVING BRUHHHHH

#

it's janky as hell but it's happening!!

vague spruce
#

i'm guessing the movement is really janky because i'm doing some stuff on the server tick. it's probably not a good idea to do stuff on server tick i'm guessing?

vague spruce
#

i found the problem. i needed to enable Allow Client Side Navigation in the project settings. this is because without it, the client side can't do any predictions and has to constantly snap to what the server is doing

vague spruce
#

hi, anyone awake?

dapper spoke
#

I need that the server local player is of a type, while the client has yet another one. Is it possible to do so? The game mode allow me to spawn always the same player controller.

violet sentinel
winged badger
#

you can also swap them at runtime

dapper spoke
#

I'm trying but I'm failing

winged badger
#

generally you can't do any of that in BP

#

you could spawn another PC, but there is no way to associate it with a player in blueprints

dapper spoke
#

oh ok make sense why I can't do that

#

Perfect ty I can try to override SpawnPlayerController then

#

Also, why it's forced to have a player controller? For example, the server doesn't need a player

#

What if SpawnPlayerController returns nullptr on server? It will cause troubles or it's totally fine?

#

Well, seems fine return nullptr

#

Nope, return nullptr shutdown the execution.

meager spade
#

why would the server have a different playercontroller?

#

i cant seem to see a logical reason why you would need to do that

winged badger
#

asymmetrical gameplay would be my guess

#

why wouldn't it matter if server doesn't have the PC, that one flew right by my head tho

dapper spoke
#

The server doesn't control any actor right? why it need a PC

#

In an real scenario, (not in editor) the server is just an headless peer where each client is connected to

chrome bay
#

The Server has all player controllers

dapper spoke
#

yes

chrome bay
#

Clients have their own. Server still needs them all, one for each client.

dapper spoke
chrome bay
#

A Dedicated Server might not have a local controller, but that's not the same thing.

dapper spoke
meager spade
#

the server spawns his own local controller?

chrome bay
#

But there's no local player on a dedicated server so how would that work?

dapper spoke
#

Hmm so I'm probably missing something. On editor, when I start play with 2 clients (one act as server) but it also has a local controller

#

But it should not have one

#

Right?

meager spade
#

depends if we are talking Dedicated or listen server

#

ofc listen server will have a playercontroller

dapper spoke
#

Is it possible to spawn a Dedicated server in editor?

meager spade
#

is lost and confused rn

#

bottom one will spawn a dedicated server

#

middle is listen server (one player is also server)

dapper spoke
#

oh, here the issue then, so I can't have a dedicated server with UI where I can control the settings of each player connected to it.

chrome bay
#

You can't do that no

dapper spoke
#

I kind of need to do from a client

chrome bay
#

Yeah, either you have a connected client and build an RCON/Permissions system where clients can change game rules

#

Or some external app that can communicate with the server

dapper spoke
#

Ok it's much clear now, thanks a lot!

twin juniper
#

On the subject of replicating TArrays, am I right in assuming that updating an array on client that is static in the sense that the members are not removed, only their values are changed is less bandwidth than replicating a smaller array which is changing indexes all of the time?

#

As an example, an array of 10 members for the former and an array of two or three for the latter.

limber gyro
#

has any 1 here messed with steam's inventory? more specificly, dynamic_props ? could really use a hand

chrome bay
#

@twin juniper if the array size isn't changing then yeah, it probably will be cheaper to change individual elements

kindred widget
# twin juniper On the subject of replicating TArrays, am I right in assuming that updating an a...

With arrays of structs, if you add a new index, the whole struct gets replicated. If you just change one property in a struct just that one property gets replicated. One interesting note is that even when changing a single property, the whole array will resize to match the server's array size, such as if the client removed a bunch of indexes and then got replicated to. The added indexes that weren't part of the replicating properties will be default filled.

twin juniper
#

@kindred widget Very interesting, thank you for enlightening me. @chrome bay Seems like it, thanks.

clear sand
#

Hey guys, can I from game state on remote(server) modify player's local game instance? I want to set some values to their local game instance for caching purposes

winged badger
#

you can modify the local game state, or another replicated object

#

then it can modify the GI

clear sand
#

Sorry I meant GameMode, not GameState

#

I'm overriding FindPlayerStart in order to have dynamic spawn points and while inside the function - I want to to set some values to controller.GetPawn()->GetGameInstance instance

limber gyro
#

gonna ask again might get lucky this time,

#

does any 1 have experience with steam backend stuff

#

i am struggling with dynamic properties

winged badger
#

@clear sand GI is not the way to transfer local information into player starts

#

the timings will be off, for everything

#

and if you're not doing c++ you have zero tools to get it in execution order you need

#

alternative is lobby map + client RPCs its information to server, its saved in its PlayerState

#

then you do seamless travel, the player state will either persist or its data will get copied over when the new one is instantiated

clear sand
#

Do you mind if I contact you in PM regarding some details? Would appreciate it

winged badger
#

and you have the data, ready, server-side before the pawns are spawned

clear sand
#

Im using c++ for coding, but Im struggling to set up correct architecture. Mainly I start my client without connection to server to do login, etc. After that I save login tokens in my game instance, and connection to dedicated server

winged badger
#

i was about to take a break, just done with work for the day, so not into long discussions atm

#

i did have extensive chats about this topic on this channel

clear sand
#

I see, no problem, thanks for your input. I think I have some direction to work on

winged badger
#

so you can try a search

#

good keyword is probably HandleSeamlessTravelPlayer

clear sand
#

I will give it a try, thanks 👍

winged badger
#

basically, tl;dr; version

#

if you connect to a lobby first

#

it allows you to setup everything before transferring to game level

#

if your game level requires clisnts to RPC the data, then you have to manually delay everything until that data arrives, basically overwriting the entire GameMode class

clear sand
#

thing is - I dont have lobby, its going to be mmo-like, where locally I do some auth stuff and connect to dedicated only when everything settled

#

but I have some ideas now

#

thanks

winged badger
#

the login options information is available early enough

#

its just exceptionally clumsy to handle

#

multiple pieces of data encoded in a single string... ugh

clear sand
#

besides response information, there's 3rd server that handles sessions and other stuff related to game logic, so login actually creates a session on 3rd server and this is the reason why I do this outside of dedicated server before connection to it. Once connection settled - I know I can connect to dedicated server(there's some prelogin things going on as well)

#

Its not complicated, rather needs a lot of back and forth

pallid canyon
#

Does anyone have experience with Oculus dedicated servers?

vague spruce
#

anyone have any experience showing a loading screen when the client is connecting? i'm trying to set up a UUserWidget to show on UGameInstance::Init but i still see the weirdness before the server is ready and player is possessed

crystal crag
#

Has anyone overridden the UControlChannel class to handle async authentication here?

#

That sounds neat, but I am not sure if there are any major drawbacks to doing it.
"Since UE4 managing auth inside of chain that heads from UControlChannel::ReceivedBunch to UWorld::NotifyControlMessage, it is possible to override its logic and reroute NMT_Join or NMT_Login packages to your custom channel class derived from UControlChannel. You may not close your connection nor sending any data to it and it will remain stall, waiting for your response. Mean while you can do anything asynchronously and than respond to that connection later in way it responds by default."

mellow stag
#

Hello! I am trying to use a system where it's player hosted servers through steam where players can just join other players sessions, the system works great but there is SO MUCH lag for whoever isn't the host no matter who hosts it...

hasty yoke
#

how do i get two clients to share the same actor present in the level owned by the server, but have different behaviors as if they had their own local copy of that server?

vague spruce
#

anyone know how to replicate LastUpdateVelocity on a CharacterMovement component? i have an animation blueprint that depends on LastUpdateVelocity, but the animations only work on the local pawn and not on any server pawns

steel vault
crystal crag
#

sigh no one really ever answers any of my questions

#

months just go by. every question I ask is ignored

vague spruce
#

the only way youre gonna get answers is with money. and ive offered money and i still dont have many answers

cosmic trail
#

Should I assign a single core to a dedicated server process or two or more cores for unreal? Trying to have a cheap dedicated which is still relatively performant and can serve as many players as possible.. I'm quite new to this

winged badger
#

i think 2 is standard

cosmic trail
#

Ok, means I should schedule async tasks mostly after physics probably on the second core

#

thanks! will try with 2

vague spruce
#

do replicated properties need to be publicly accessible? as in, not private or protected

cosmic trail
#

no, can be private

vague spruce
#

is it normal for there to be a lot of corrections when an character is colliding against something?

cosmic trail
#

it depends, usually no

#

if you're not emulating network conditions, and the obstacle is static..probably shouldn't be seeing corrections

vague spruce
cosmic trail
#

if you are seeing corrections, there could be something amiss with your client prediction

vague spruce
#

is it generally a bad idea to store replication properties inside of the controller? does it make more sense to move those properties to an actor?

hollow eagle
#

controllers are actors, and a common place to store data that only needs to be seen by the owning client and the server

vague spruce
hollow eagle
#

player controllers should already replicate

vague spruce
#

cool

#

should i set up doreplifetime then?

hollow eagle
#

you will need to do that for any replicated properties, yes

vague spruce
#

okay, cool

#

that makes my life easier

hollow eagle
#

just note that player controllers only exist on their owning client and the server

#

other clients will not see them

vague spruce
#

totally fine

#

i was moving a lot of these properties over to the unit

#

but this property in particular makes sense only to the owning client and the server

#

and no one else

#

so i'll keep it in the controller

#

ty @hollow eagle

#

every 150ms i send a new destination to the server so as to not flood the server needlessly with new destination RPC calls. the rotation is actually determined by the character movement component, and bOrientRotationToMovement is set to true. so i have no idea LuL

crystal crag
#

@vague spruce that's a shit community if that's true. I am not at the point of believing that yet. I have been programming for over 15 years, doing all kinds of work, and so far getting basic answer for high level concepts is like pulling teeth. It's ridiculous. Surely someone knows the answer and it would not take long to explain it.

vague spruce
#

i have yet to get a single person from this community to do (paid) consulting for me, so don't get your hopes up. i have 10+ years

#

but in general a lot of people here are very very helpful. it's just that some problems are very specific to your implementation

crystal crag
#

My frustration isn't with those types of questions though. At least then that would make more sense.

#

My questions recently have been more basic. "Hey, does anyone know why in anim bp, using leg ik suddenly locks the legs inward, starting with ue4.25?" "Works fine in ue 4.24.x" I don't remember the others right now, I would have to search for them and it is late.

vague spruce
#

i mean, that's pretty ambiguous

hollow eagle
#

it's not ambiguous, it's super specific

#

too specific for most people to know off the top of their head

#

and not trivial to test for someone who doesn't already have that environment setup

crystal crag
#

But it happens in both pre built binaries and source build

#

With a brand new third person template

#

Take the default animation bp, slap a leg ik on it, compile in ue 4.26.x, boom, legs lock inwards and the legs stop moving

#

Well, obviously you have to enter the settings in tbe node

#

Before compile

hollow eagle
#

I'm not trying to solve your issue, this is the wrong channel regardless. I'm telling you why no one has the answer to those kinds of questions

vague spruce
#

I’m not sure you’re going to get answers for those problems pretty much anywhere. It’s ambiguous in the sense that there are too many factors at play

crystal crag
#

Right this is mulriplayer I asked that in animation. I'm just having a bad day. There is no point venting on here.

#

Thanks for listening to me rang

#

Rant

vague spruce
#

game development is incredibly frustrating. i was stuck on a problem today, turns out i was calling Server_Implementation on the client instead of Server

#

took me hours

#

i feel you brother

#

should i just ignore these corrections? my game is running buttery smooth now and it looks great

#

wow, actually these corrections basically only happen inside of pie. so im gonna move on

#

friggin pie OmegaLUL

cosmic trail
#

maybe turn on emulate network lag

#

it really brings out why those problems happen sometimes

vague spruce
#

good call ill try that a bit later

#

anyone know how to get both editor windows to keep their height and width? i'm having to resize my window every time

#

how do you all check if something is running on the client? !HasAuthority()?

cosmic trail
#

GetNetMode() == NM_CLIENT

vague spruce
#

ty sir

cosmic trail
#

if client created object, it can still have authority

vague spruce
#

thats a very good call

dark edge
heady python
#

Is there a specific order that blueprints spawn in or is it random? Occasionally ill get errors saying that an actor doesnt exist when i try and reference it in beginplay. Playerstate, playercontroller, character, gamemode, gamestate, gameinstance, savegame are all what i have this problem with.

buoyant crag
#

pretty sure it depends on the loading, if i get your problem, loading time could be random

heady python
#

Hmm. so sometimes the gamestate spawns first and sometimes the gamemode spawns first? Theres no predicting it?

buoyant crag
#

hmm im not sure what the problem is so i dont know what to tell you to be honest

chrome bay
#

GameMode will always be first since that's server-side only, and the GameMode spawns the GameState

#

On the client however, you can receive actors in any order

#

So you have to code around it

#

GameInstance will always be available. Most commonly you'll have the issue with things like Pawn, PlayerState and GameState

#

A good way to deal with it, is to create a central event somewhere that all of those actors call (GameInstance or a Subsystem would be a suitable place, since it's always there). Actors can bind to that event, and call some kind of "Setup" function when they have everything they need.

#

Easier to do in CPP of course

vague spruce
#

i'm seeing spawned actors appearing and disappearing. the spider is an actor spawned in by the server. any ideas why this could be? i've read online that it's because of RPC spam, but idk

#

marking the spiders as always relevant seems to work

chrome bay
#

Most likely the server doesn't know where the player/camera is, so it doesn't know what is relevant to them atm

#

Oh actually, perhaps the spider is massively offset from it's origin somehow? Or has a tiny relevancy range?

vague spruce
#

you're onto something. so, the camera is actually 15000 units away

#

and the fov is at 10

#

it's to give it an orthographic camera feel

chrome bay
#

Yeah that's the issue

#

150 Meters is the default relevancy range for actors

vague spruce
#

any way to change that?

chrome bay
#

You can bump it up, but really it'd be better to move the camera closer and use a normal FOV

#

As otherwise you'll be replicating a lot more than you need to

vague spruce
#

alas

#

i wish

#

but shadows don't work with orthographic cameras

chrome bay
#

It might be just me be to be honest, I can't tell that's an FOV of 10. It just looks like a closer camera

#

But at an FOV of 10 I expect you'll see rendering issues and stuff anyway

vague spruce
#

it's a trick to get the camera to have an orthographic feel

#

yea, i've already run into all kinds of stuff

#

would be great if, you know, shadows worked in orthographic cameras

#

lmao

#

i could try a normal camera

#

let me change it

chrome bay
#

honestly to me it just looks like a fairly standard FOV that's closer, I wouldn't know the difference unless you'd said

#

As an alternative, you could also make an engine change so that the relevancy viewpoint is your pawns' location rather than the cameras

#

And then make the relevancy distance far less than 150M

vague spruce
#

oooooo

#

that's a great idea

chrome bay
#

Actually ignore me you don't need an engine change for that

#

Just have to override APlayerController::GetPlayerViewPoint()

#

Maybe just for non-local only and on the Server

vague spruce
#

!!!! ill check it out

#

@chrome bay so what i just set the view point to the actor's location?

chrome bay
#

Yeah just using the pawns location if it has one currently

vague spruce
#

let's see if that works

tawny mason
#

Hi guys, i'm experiencing some saturation when the listen server has high framerates

#

Do these variables even work ?

#

Does anyone know how to clamp server side net ticks ?

vague spruce
#

@chrome bay modifying that function breaks the camera unfortunately

#

oh well, ill figure this out another time

chrome bay
#

Ultimately you just need to change the FNetViewer::ViewLocation

#

@tawny mason Run the network profiler and see what's causing it. Sounds like you have RPCs that send every tick or something. IIRC those settings don't affect RPC's

tawny mason
#

The outrate inrate does not change, it's the packets in and out, so i'm asuming those are saturating my network and not the actual bandwidth

#

i think they are not clamping my network, the config vars are supposed to be working fine right ?

#

if i set t.MaxFPS to 60 or 30 the saturation is not there, i assume it could be the rpcs as well, but i dont see any rpc being sent that much

#

ty by the way @chrome bay

chrome bay
#

IIRC all those values do is clamp the rate of the network tick clock, I.E. the rate at which it gathers variables for replication. I'm fairly sure they have no effect on things like RPC's, since presumably you want RPC's to be sent asap

tawny mason
#

ok, i will try to find any rpc being sent every frame or couple of frames but im pretty sure we arent doing that

#

i'll be back hehe

chrome bay
#

The profiler will tell you exactly what's being sent and how often

tawny mason
#

ok i will have another look, not too experienced with multiplayer

#

thanks again @chrome bay

chrome bay
vague spruce
#

as always thanks for all of your help

twilit radish
oblique mountain
#

I want to replicate the Loc and Rot of an actor (pawn) over rpc's but I have a problem from the client side. I'm using "Switch has Authority". The Server sets the Loc and Rot and replicates as "Multicast" and the Client uses "Run on Server" to set the Loc and Rot. But I think I have a double replication because the movement on the client side is extremely laggy/jittery. Can someone pls help me?

tawny mason
#

@oblique mountain are you updating a player controlled pawns transform by tick with an RPC ? If that is the case, is it a character ? If not, i would recommend just replicating the actors rotation and rotation with the replication config on the actor class

oblique mountain
#

Yes I'm using tick but I dont know what you mean with the rest 😦

tawny mason
#

as @chrome bay said just some messages ago, tick and RPC are not good friends

#

in the actors default class settings, you can find within the replication category some variables to enable replication of the actors transform

#

on the other hand, i do not understand what your goal is

oblique mountain
#

You mean like replicate Movement and stuff like that?

tawny mason
#

you are sending the same information back and forth from what i can see

#

yes

oblique mountain
chrome bay
#

All you need to do to replicate movement from Server->Client is check "Replicate Movement"

#

You will get jitter no matter what. Character Movement has smoothing built in to deal with it.

tawny mason
#

as @chrome bay just said

chrome bay
#

For any other object, you'll have to implement the smoothing yourself

#

Usually done by having the root component update instantly, then having the visual components interpolate their relative offsets over time.

tawny mason
#

Mark the red ones to ON, and remember to set a suitable NetUpdateFrequency

oblique mountain
#

So I cannot just say as client a to update the Loc and Rot of this Actor on the Server and all other clients expect client a?

tawny mason
#

as low as you can get away with

#

yes you can

#

but you should not do that with RPC

#

but using these variables

#

if you want to make user A set the location of the actor

#

the only RPC you need is the one from user A to the server

#

the multicast to all other clients is not necesary

#

but multicasting every frame is not good either

twilit radish
#

Just wondering, but a multicast would also destroy the net priority of those replicated actors in this case right?

#

As in that if you keep calling a multicast that it would be prioritised regardless of whether or not it would have to be prioritised for every client.

#

Or am I saying something stupid?

oblique mountain
#

If I use "Replicate Movement" it only woks from Server to Client so I still manually need to do the replication from the client to the server or am I missing something?

twilit radish
#

Just a question, but what kind of game do you have Lennard? Because this seems really easily to exploit if you're trying to sync player positions this way, which may or may not matter of course 🙂

oblique mountain
#

Its just a Hide and Seek type game for private use

#

its so sad that the character class can only use the capsule as collision

tawny mason
#

given you are using the variables mentioned

oblique mountain
chrome bay
#

2.f is an incredibly low net update rate for characters

#

Probably want it much higher than that for things that are moving and relying on rep movement

#

One of the few actors where the default setting makes any kind of sense

oblique mountain
#

Btw: Thanks for all your answers!

tawny mason
tawny mason
#

But don't do it on tick

#

are you moving it based on the character viewpoint or something ? i would recommend having a desired location variable for example and reading that on server and moving it there, set that variable to whatever you need and whenever it replicates move the objet to that position

chrome bay
#

Clients shouldn't really be setting the transform of actors they don't own though, that indicates a design issue

tawny mason
#

true

chrome bay
#

You should only be sending RPC's to the server with object transforms if it's something the client is controlling movement of (e.g. it's character)

#

But the character class does a lot of work under the hood to avoid sending RPC's too often

#

And everything is does send is sent unreliably

tawny mason
chrome bay
#

If it is a character btw, you do that by possessing it and calling AddMovementInput - everything else is done for you

#

If it's anything else - you've gotta do all that yourself

tawny mason
chrome bay
#

Multiplayer & Blueprint hits a ceiling pretty quickly unfortunately

#

You can get by with basics, but most of the real sauce is in CPP

oblique mountain
#

I should probably read more about networking and replication stuff

#

@tawny mason you said that it is not correct that the character class can only use the capsule as collision. Because this was the only reason why I'm not using the character class because I was not able to use something eles than the capsule

tawny mason
#

you can use whatever collision you put on the character

#

you will have to support those other colliders and configure correctly the collisions and physics layers but i don't see why you would be stuck with only the capsule

#

i use multiple colliders on my characters, the capsule is only used for navigation

#

in my case ofc

chrome bay
#

character movement only supports an upright capsule though

tawny mason
sharp kestrel
#

Does anyone know if there's a way to ping a server to check if its being advertised or not?

Every session starts as being advertised and then gets that set to false once the lobby countdown has ended.
I changed the system from simply joining the first session found ASAP to instead store a list of all available servers.
This brings up the issue though that servers can change that advertised status while players are still viewing them on the server list.

eternal canyon
#

u could have a custom paramater

#

thats like a boolean

#

and in find sessions advancd

#

only find sessions with that boolean being true

#

in find sessions advanced

sharp kestrel
#

Advertised is already a boolean in adv sessions, the issue is that there doesnt appear to be a getter for it, it's only usable during the find sessions, which doesnt help if the server is already found.

dense ocean
#

If Actor A is spawned and replicated to all clients, and this actor spawns Actor B from within it, will actor B automatically inherit the same replication? Or must it be explicitly replicated

buoyant crag
#

if itll actually spawn and not be a child of that actor, Actor B should be explicitly replicated, im pretty sure

dapper spoke
#

I've created a new ReplicationGraph, and I'm following this as example: https://github.com/EpicGames/UnrealEngine/blob/release/Engine/Plugins/Runtime/ReplicationGraph/Source/Public/BasicReplicationGraph.h
I've created a single UReplicationGraphNode_ActorList and added using AddGlobalGraphNode, but the replication is not performed. My character doesn't spawn on the other side.
Consider that in the RouteAddNetworkActorToNodes I'm adding all the actors I receive: GlobalRelevantNode->NotifyAddNetworkActor(actor_info);, but still doesn't work.

Clearly I'm not doing something, though, what? any idea?

dapper spoke
steel fox
#

If I call HideBoneByName on a replicated skeletal mesh should It hide the bone correctly? I'm trying to use it but it works only on server

peak notch
#

The GameInstance is affecting every player or is it being created separately for every player.

steel vault
#

Why are you replicating a mesh? As far as you should be concerned, your server has a copy and your client has a copy. Why not hide them both or simply the client version?

steel vault
peak notch
#

Ok got it thanks

steel vault
#

It is not replicated.

peak notch
#

i see

vocal cargo
#

Hey guys, is there any way of calling server functions on a actor from different players?

#

I have two characters controlling a pawn but I cannot call the server functions because (I think) it needs an actual owner?

steel vault
#

That is correct. The actor cannot make an RPC call unless you call SetOwner on it and set its owner as your character for instance.

vocal cargo
#

Then what are my options here exactly? 😐

dark edge
#

Press Spacebar -> RPC to server side PlayerController -> call Jump on TandemCharacter

peak notch
#

why is the client1 seeing the client 2 print string and why is the server executing the code aswell

#

playing as Client

#

with 2 players

steel vault
leaden atlas
#

if you spawn a replicated actor on the server, can you send that actor back to the client in an RPC?

#

this doesnt seem to work. In Building Visualization seems to always be null

#

okay i got it, i gotta put it in a repnotify variable

peak sentinel
#

Is there any replicated ENetRole enum inside of anywhere? I want to skip a server function to prevent clashes between client and server via if(ENetRole == ROLE_AutonomousProxy)

#

I remember I saw it one day, but couldnt find

umbral granite
#

How can I join/create session by internet with SteamOnlineSubsystem?

kindred widget
#

@leaden atlas The generally preferred method for that is to spawn the replicated actor, and then set a replicated pointer to the actor, and do whatever you need to do with it on clients, OnRep.

peak notch
#

Playing as a client or playing as a listen server it doesn't matter print string will show on every client when one client does it is that suppose to be or do i need something like hasauthority?

umbral granite
#

I think you should change the create session to happen when it fails finding sessions not when has finished searching sessions

peak notch
#

i tried that idk why it doesn't output than

#

but my issue is when one client execute this code it outputs the string on every other client

#

are print strings replicated or something lol

umbral granite
#

This is an example of an structure of searching, joining and creating a session

#

And you don't have to open that level when you join a session because when you created the session you alredy are telling to all clients to open that level when they join it

umbral granite
#

The structure should be something like this (sorry for the bad drawing quality)

peak notch
# umbral granite

this i understand my issue is that when client 1 presses the ready button it creates the session and changes the level and prints the string for itself also for client 2 why is the print string showing on client 2? even tho different client and haven't pressed ready button on that

peak notch
umbral granite
#

because in your actual structure it will always create a session

peak notch
#

when i do it using on failure nothing happens

#

like no output from failure

umbral granite
#

try to turn that session into a variable and in -complete if the variable is valid join session and if it's not valid create one

umbral granite
peak notch
#

i low key think you are misunderstanding my problem and i am not being good at explaining haha

umbral granite
#

I thought you were trying to find sessions and if it fails to create one, but now I'm confused 😅

peak notch
#

no lol

#

when one player joins a session the print screen is shown on every clients screen

#

😄

umbral granite
#

Ahhhhhhhhhhh

#

I think it's because strings are shown to the player screen, but I don't use them frequently so I don't know...

peak notch
#

im guessing that they are replicated so eh imma ignore them for now

#

btw do we have to make our own list of sessionnames or can we make a session with a name ?

dense ocean
#

I have an actor in my level that generates a maze. I use the gamemode to call the generate maze event, which is multicast. However, I can only see the maze generated on the server. How do I properly replicate this action? What am I doing wrong?

thin stratus
#

Where is that multicast?

#

Also in the GameMode?

#

@dense ocean

#

Because the GameMode only exists on the Server. You would need to do that in the GameState

dense ocean
#

oh interesting, yes its in the gamemode

twin juniper
#

Im having tons of issues, im having trouble trying to replicate damage to everyone

#

so if someone gets shot the damage is calculated as it should be on the one who got shots side. only one who needs to know their health, but if that player heals, then is shot again, they get killed because the other clients or server still think they have that high of damage.

#

if that makes sense

#

so player gets shot and has 10 health

#

they heal to 100

#

then shot again they get killed instantly because server or other client still think they have 10 health

steel vault
#

Your server should be the only one modifying the actual health values and what happens when they reach 0 (dying etc.). It sounds like your heal isn't happening on the server or you have separate health values between client and server. Make sure server is the only one with the health variable replicated and if it has authority, then make health changes that should replicate down to clients.

twin juniper
#

see when the projectile hits a player it calls an interface event to the player to deal damage,

#

the player bp then takes that damage and sets current health

#

so how would i do this? make a runs on server custom event?

#

ive looked all on the internet and all examples do line traces for hitscan, not projectiles. and they all keep using the apply damage node, which i think would be better done by calling custom events instead

winter plover
#

Sending an RPC to only a specific player only works with client owned actors right?

dense ocean
#

@thin stratus Thank you! Is gamestate used to handle gameplay events that should be replicated? If not why would you recommend GameState for this case?

#

I also can't seem to get it work from the gamestate. On begin play for gamestate, i use switch on authority and if authority, I call the multicast event which gets all actors of class (my maze) and tells it to generate

twin juniper
#

This is the bps in the player, the first event in top left is called from when a projectile hits the player. when shooting the server it calculates correctly but when client is shot, it keeps going back to 12 every time, itll go to 24 but then immediatly back to 12 every time they are hit

steel vault
#

Why are you adding damage to current color and then setting current color? You should have a health variable on the server that gets changed by the damage which is set to replicate

twin juniper
#

because in my game damage isnt taking health its adding color to a player, its strange i know.

#

but i dont understand

steel vault
#

Ok so if Current Color is set to replicate

#

Then when it changes on the server, that's all you need to do

twin juniper
#

if i change variable on server, that would change the color on server only wouldnt it?

steel vault
#

Delete do damage client and move its logic up to the server node

#

No.

#

If the color is set to replicate, it will change for every client

twin juniper
#

ok let me see

steel vault
#

Set it to replicate, change it on the server node, profit.

twin juniper
#

how the hell does that even work

steel vault
#

Replicated properties in UE4 are distributed to all connected clients. That's just how it works.

twin juniper
#

setting variables through a custom event the runs on server sets the variable on the server does it not?

steel vault
#

Yes

twin juniper
#

so then only the server should be changing

steel vault
#

Yes

#

But if the variable is replicated, everyone sees the change.

twin juniper
#

then how does the clients take damage when it isnt called on client

steel vault
#

Because clients mirror replicated things

twin juniper
#

doesnt that mean the client would have the same health as a nother due to it mirroring it?

steel vault
#

It means if the server says Player A's health is 90, everyone else see's his health as 90 too without doing anything else but setting it to 90 on the server.

#

If the client changes Player A's health to 80, the server will backhand the client and put it back to 90 when it goes to change again. The server is your source of truth.

#

How else would you prevent hacking?

#

You can't just let the clients do whatever they want, you need the server to make important changes and distribute them out to clients.

twin juniper
#

i just dont fully understand it, when i call an event of server and say set this variable, the variable is set on the server side not the client unless i call run on owning client

#

so when i see set current color running through server custom event, i think its just changing the servers color

#

not the client that needs the color

steel vault
#

No. That is the point of marking the variable as "REPLICATED" because it takes care of that process for you

#

It's UE4 under the hood magic. You change a replicated variable once on the server, it will make sure everyone knows about it.

twin juniper
#

i thought replicated variables meant its the same for everyone, not in the sense of letting everyone know what it is, but everyones color would be the same because its replicated, which means makes it the same

steel vault
#

I don't know how else to explain this to you... yes, if the color is replicated and the color is green, everyone will see the character as green. Which also means, if you change it to red on the server, everyone will see it as red.

#

One server change, distribution to all clients..

twin juniper
#

no i understand that now, im just saying what i thought replicated variables meant

steel vault
#

Gotcha

twin juniper
#

i thought it meant if you changed a replicated varible on the server, itd make everyones color that amount,

steel vault
#

It does.

twin juniper
#

i meant everyones personal amount

steel vault
#

It just updates the client's local copy of it.

dense ocean
#

If i have an event that generates a random number and replicate the event to all clients, will all clients have the same random number or a different one from that seed?

#

I'd test it myself but I'm having a lot of trouble with replication

steel vault
dense ocean
#

Okay thank you

twin juniper
#

u said it does, i dont think u know what im saying

steel vault
#

I don't, but it doesn't really matter. Test what I said and it should work.

twin juniper
#

it does,

#

im just trying to specify what i mean so i can fully understand it.

#

just having it work doesnt mean i know how to implement it unless i understand it u know

steel vault
#

I realize that. And I have given very in depth explanations, so I hope that helped.

twin juniper
#

well as i said u didnt understand what i was trying to tell you, so it made it work but i still dont fully understand it but its fine i suppose.

#

thanks

winter plover
#

So I have a map of items I want to keep replicated across all clients (item id => some item data)

#

the item data may change sometimes

steel vault
#

Try to reread what I wrote. Ask me something specific if you still don't get it.

winter plover
#

so every time that happens on the server I have a NMC RPC broadcast those changes alongside with their key

#

the problem I have now is, when a client connects midway into the game

#

how do I best send that initial chunk of data to them?

#

as in, how I do I detect a new player and ONLY send the data to their client?

twin juniper
#

@steel vault ok so another replication issue then

#

when shooting the server from client side it does only the 12 damage its supposed to

#

when anyone shoots a client tho, it does double that amount, there is one server and two clients when testing

steel vault
#

Then you are calling the event twice

twin juniper
#

i only have that code i showed u

#

its only calling that event on the server once

steel vault
#

Where is do damage getting called from?

twin juniper
#

a projectile

steel vault
#

Do Damage could easily be getting called twice then

#

Multiple overlaps?

twin juniper
#

nothing but one thing has collision on it

#

and the only thing that would react to it on my player is the capsule compnent

steel vault
#

Put a print where it gets called

#

Find out if it is getting called twice or not

twin juniper
#

called only once when server hit, or when client hit

#

but double the damage is being done to clients, but not server

steel vault
#

Can't really debug your code without seeing or knowing more. If you are only calling the server set event once then it will never do double damage. Print out the damage amount as well

twin juniper
#

ok ill show the prints

#

ok here we go

#

@steel vault client shot server, called only once

#

server amount of damage

#

when hitting P

#

server shot client once, called once, and amount of damage is doubled

#

sorry forgot the code

#

this is the coding

winged badger
#

that has a code design setup of an unreal tutorial 😦

versed socket
#

Seems like dedicated servers don't have SaveGame instances available. Are we supposed to setup manual filesystem OS reading and writing in C++ for configuration persistency? I'm sure there's just another thing I'm not aware.

winged badger
#

there is no sense saving a game on dedi itself

#

how would that work once the game is released? player would have to find a spot on exact same dedi it played on last to continue

versed socket
#

My use case is for server configuration - for a listen server, or for standalone, it can be just a trivial savegame that we can use to persist across GameInstances. However for a dedicated server we can't do it that way, so I imagine there's another solution.

winged badger
#

its not that hard to manually save stuff in user/appdata/local

versed socket
#

Right, so you're saying that we should do manual filesystem OS reading and writing?

winged badger
#

i did, did not find the save spot system adequate for anything except roguelike or a platformer at a glance

versed socket
#

Right on - I'll look for UE4's filesystem reading and writing interfaces

winged badger
#

IPlatformFile& PlatformFile = FPlatformFileManager::Get().GetPlatformFile();

#

start there

#
FString UGlobalDefinitions::GetSaveDirectory() const
{
    FString Directory = FPaths::Combine(FWindowsPlatformProcess::UserSettingsDir(), TEXT("YourProjectName/Save/"));    

    IPlatformFile& PlatformFile = FPlatformFileManager::Get().GetPlatformFile();
    if (!PlatformFile.DirectoryExists(*Directory))
    {
        PlatformFile.CreateDirectory(*Directory);
    }
    return Directory;
}```
#

this tidbit might also be useful

#

this returns the User/AppData/Local/ProjectName/Save directory

#

(on windows, the code is platform agnostic)

twin juniper
#

can anyone tell my why this is causing it to do double damage to the clients but normal damage to server

#

even when not being called twice?

versed socket
#

Probably it's running both on the server and the clients involved

#

So the server does it once, and then each client does it to themselves

twin juniper
#

but its set to only run on server

versed socket
#

Good point I'll take another look

versed socket
twin juniper
#

listen

versed socket
#

I think if you print IsStandalone IsServer and IsDedicated for everybody you might find that someone thinks they're a server when they're not supposed to be. That'd be the simplest explanation, but I don't know for sure.

twin juniper
#

how is that even possible

versed socket
#

Maybe the Listen Server player thinks they're both a Client and a Server

twin juniper
#

so do i need an authority check before calling the do damage on server event?

versed socket
#

Always a good habit

twin juniper
#

ill try that i guess

winged badger
#

@versed socket noticed a tiny bug in my code there, it should be FPlatformProcess::UserSettingsDir() not FWindowsPlatformProcess to be platform agnostic

twin juniper
#

@versed socket the authority check worked. what the absolute hell happened?

#

never ran across this before

winged badger
#

your server never did double damage

#

your clients did damage ontop of the server damage

versed socket
winged badger
#

also, please wrap that health (color) setting code in a SetHealth function

#

as the game develops there are usually dozens of things you need to do that are atomic to health changing

#

and if you keep stringing them by hand every time you need them, you'll soon want to hurt yourself

twin juniper
#

oh i know, im just starting thi project so im just getting basics out there

#

ill organize as i continue

#

@versed socket thats so damn weird

versed socket
#

What I learned when I was new to this was that HasAuthority is something you should always do as a safety precaution

twin juniper
#

im just surprised it works, because if its remote it doesnt call the do damage event,

#

which id assume if you were a client shooting someone, then it wouldnt do damage because its not asking the server to do it

#

but it still works?

winged badger
#

that event called from overlap @twin juniper ?

twin juniper
#

on hit

#

when projectile hits the player

winged badger
#

but whatever is hitting exists on both server and client?

twin juniper
#

the projectile is replicated and only spawned on server side

winged badger
#

doesn't matter, if the client handles OnHit separately

#

and then RPCs the damage

#

(doesn't matter how the projectile came to be, from replication or not)

twin juniper
#

yeah the actor projectile replicates, and when client shoots it does a server custom event that spawns projectile

#

when the projectile hits a player, it calls that do damage interface event

hallow acorn
#

hi guys! quick question, is there a way to know the responsible for an OnRep being called? thanks!

thin stratus
# dense ocean

You can't do it like that because the server will call this when it's GameState starts BeginPlay, which is before any client is connected. At least without any modifications.
Try to just use BeginPlay for everyone and cut the Multicast or only call the Multicast when everyone is connected

winged badger
#

@hallow acorn wdym? server is responsible because it changed the value of a replicated variable

hallow acorn