#multiplayer

1 messages · Page 240 of 1

cold cipher
#

I want to use peer to peer for multiplayer, but it seemed that the hosted lobbies can only be accessed with pcs using the same wifi

#

is there anything I forgot? or do I have to hook it up with steam first

upbeat basin
#

If you haven't setup your OSS (like Steam as you mentioned) then it'll use Null OSS (by default), which will only support lan connections

shrewd ginkgo
#

where I need put steam_appid.txt in packaged game

chrome bay
#

If you want actual session management, you will need to use some online service backend to provide for it

grand kestrel
quasi tide
#

Anyone who uses CMC
Soooooo like everyone

karmic trellis
#

@upbeat basin I tried what u said but still same resultcrying. Btw I tried with character movement too but result is worst.

#

This problem is still continouning. anybody can help me about listen servers

thin stratus
exotic wasp
#

mover feels so attractive to me since I'm making a game where you can control many different things

#

but it sounds kinda awful still

thin stratus
#

Don't touch it.

quasi tide
#

I ain't touchin' it until Fortnite has had at least one full season on it.

grand kestrel
quasi tide
#

I'm still at work foo. I'll upvote it after work 😅

grand kestrel
#

Your priorities are whack

quasi tide
#

I agree. SIlly me for wanting to eat.

grand kestrel
#

Exactly

thin stratus
#

Downvoted. You're welcome!

fossil spoke
errant mulch
#

hello guys! im trying to change a variable from a widget so it prepares a player for the next round, but on the check, it still treats each client as their individual worlds without changing the variable for each character, so both players are never "ready" . I have tried a bunch of stuff like rpcs, trying the changes in the gameState/gameMode, the variable for the players are replicated, but nothing seems to get the job done

this is the first general code inside the widget

#

this is the code that readys the players, inside the gameState

#

and this is the loop to check if everybody is ready, also inside the game state

#

what i am missing/doing wrong?

grand kestrel
fossil spoke
#

Since each Player has to declare they are "Ready", this should be a variable on their PlayerState.

#

The GameState would then just check all PlayerStates for their "Ready" state.

errant mulch
#

i actually had one of those variables on the playerstate too, i cant recall why it did not work properly last time

#

if i just change the variable from the players to the player state it should work?

fossil spoke
#

No

#

Thats only part of it

errant mulch
#

i see

fossil spoke
#

Another thing I just noticed is your ReadyPlayer function is a Multicast RPC

#

But its being called by Clients

#

Multicast RPCs can only be correctly called by the Server.

#

You likely want to change it to a Client RPC instead.

#

This means that the Client that clicks the Ready Button, will send an RPC to the Server, to tell the Server that they are Ready and the Ready variable on the PlayerState should be set to true

#

That Ready variable should be set to Replicate as well. So other Clients know that Client is Ready.

errant mulch
#

and, dumb doubt, whats the difference between a client rpc call... and just having the function not being rpc at all?

fossil spoke
fossil spoke
fossil spoke
errant mulch
#

i actually have that pin on my favorites

fossil spoke
#

So go and read it, a couple of times.

#

Especially the parts on Replicated Variables and RPCs

errant mulch
#

i actually get a lot of stuff, but i have the feeling that on places is not consistant, and i do get lost sometimes wihtout specifics

#

yeaal ill give it another read

#

also i will try the fix you told me and see if it does the trick

errant mulch
dark edge
errant mulch
#

how unconsiderate from their part

dark edge
#

Your systems should work with or without UI, UI is just the interface to and display of some other system

errant mulch
#

that actually makes sense

dark edge
#

Say a player wanted to say they are "ready".

Widget checkbox event -> Run on Server RPC in PlayerController or PlayerState -> PlayerState.bIsReady changes -> repnotify
Something like that.
You could easily have a hotkey that just jumps straight to the Run on Server RPC, the functionality exists fully independent of the UI

exotic wasp
#

this is the way

errant mulch
#

it does make sense, but im always afraid that the reason im stuck somewhere is because some specific that only happens on one instance

#

but yeah, this was not the case, i can see that now

exotic wasp
errant mulch
#

as matt said, i should re read the compendium, but i like to learn doing directly the stuff in the engine and seeing it work live

dark edge
#

By default, design your systems like:

Client to Server information transfer -> Run on Server Event in Pawn/PlayerController/PlayerState

Stateful Server to Clients information transfer -> replicated variables, with RepNotify if you wanna DoStuff™️ when they change
Transient Server to Clients information transfer -> Multicast RPCs

errant mulch
errant mulch
#

and thanks for the help and patience guys

thin stratus
grand kestrel
thin stratus
#

Maybe, but I also can't say the votes have done much in the past.

grand kestrel
#

They did tell me on UDN it matters

#

See if I can find the phrasing

thin stratus
#

Well it can't hurt I guess

grand kestrel
#

If nothing else it signifies demand

#

...From a vocal and extreme minority 😄

thin stratus
#

From a group that was called to vote alex

grand kestrel
#

Related to a different issue but

thin stratus
#

Alright.

sterile gazelle
#

not sure what I'm doing wrong here but my OnRep isn't firing:

    UFUNCTION()
    void UpdateIron(int32 Amount);

    UPROPERTY(VisibleAnywhere, BlueprintReadOnly, ReplicatedUsing = OnRep_Iron, Category = "Data")
    int32 Iron;
void URInventoryComponent::UpdateIron(int32 Amount)
{
    Iron += Amount;
}
#

The variable is also in the GetLifetimeReplicatedProps

#

And both the component and the owning actor (the character) is set to replicate - what am I missing?

karmic trellis
#

I m sharing it twice sorry but anyone know well about listen servers can help me?

pale rivet
#

Hi, relevancy related question:
I have my level, I've pre-placed loot spawners on this level.
Loot Spawner is a replicated AActor with these replication parameters(see the screenshot).

I've noticed that when I`m leaving NetCullDistance with NetLoadOnClient set to true my Loot Spawner is not destroyed.
Does it mean that all pre-placed loot spawners with NetLoadOnClient = true behave like AlwaysRelevant?

lament flax
#

for some reason i cannot jump anymore on my client (prediction gets canceled by server)
after debugging, when jumping, ACharacter::JumpIsAllowedInternal returns true on client, and false on server.
it returns false because JumpCurrentCount is set to 1

lament flax
#

this is called on listen server BEFORE bJumpIsAllowed = JumpCurrentCount < JumpMaxCount;, which will return false

#

well nvm the issue was linked to how my code reacts to jump, basicly i was setting movement mode to falling before doing the jump

exotic wasp
sterile gazelle
#

yeah, I just figured it out, from a listen server I needed to call on rep manually, I thought server and client would run in a separate process

#

dedicated server it works as expected (connect as client)

exotic wasp
#

in c++, an "OnRep" only gets called on the client

#

different from bp where it gets called on both client and server

sterile gazelle
#

thanks @exotic wasp

lament flax
#

but yeah i saw it

thin stratus
grand kestrel
wheat rose
#

Hi! I need help creating a blueprint that checks when the amount of players that are specifically Hunters, are all dead it plays my game over. So i basically just need help getting if all players of hunter class are dead

quasi tide
#

How do you determine if something is a Hunter?

#

Is it a class or a tag or what?

wheat rose
#

They are currently under BP_Character_Hunter

#

and hiders are the same except hiders

quasi tide
#

Easy peasy. Have the Hunters register to the gamestate. Or a component on the gamestate. This just puts them in an array. When they die, have them unregister. Inside of the unregisteration process (on the gamestate or component if you want a component approach), check if the array is empty after removing. If so, all hunters have died.

thin stratus
#
  • Array of BP_Character_Hunter in GameState or GameMode
  • BP_Character_Hunter BeginPlay -> GetGameState/GameMode -> Get Array -> Add Self
  • BP_Character_Hunter EndPlay -> GetGameState/GameMode -> Get Array -> Remove Self -> Check if Array Empty -> Game Over
#

Potentially limit to SwitchHasAuthority in some areas, specially if you choose the GameMode for storing the Array.

#

And yes, Duro said the same thing, but I was already typing and didn't want to delete it all.

quasi tide
#

Of course, if it is possible to eliminate all spawned hunters before you have a chance to spawn more dynamic ones, you have to account for that situation as well.

blissful lark
#

does anyone here have experience with steam advanced sessions if so i got a question for you

quasi tide
thin stratus
wheat rose
#

so the current thing i have done is that when they die they become a spectator under the spectator class. Which works perfectly. is it possible to plug that ^ in around that or would i need it somewhere else

blissful lark
#

thank you

#

does anyone know any ways for ue5 multiplayer to work without ue5 source

thin stratus
wheat rose
#

the spectator stuff is handled under the level blueprint is that cool as well?

thin stratus
quasi tide
blissful lark
thin stratus
wheat rose
#

so...its cool cuz the jedi were corrupt anyway ? 😅

thin stratus
#

Actually, you could be a sith fan, then this doesn't work.

blissful lark
#

do you have a video i could follow

quasi tide
#

No

thin stratus
#

Jokes aside, don't use the Level Blueprint if possible.

#

it's usually not needed.

blissful lark
#

i cant find any videos for that and if i found one it dosnt work

wheat rose
#

okedoke

quasi tide
#

You can't find a video on joining a MP game? Or what specifically?

blissful lark
#

no like on how to make a mp game with host and join ive found many but when i go to test my game work outside of my house and with another friend it never works

wheat rose
#

i moved it into GM instead

quasi tide
#

Because if so, you need to do some port forwarding

blissful lark
#

oh ok

thin stratus
# blissful lark what if i want a basic host and join button would that require dedicates servers

DedicatedServers are headless processes that aren't themselves players.
They are usually used for games where players want to join the server, do some stuff and leave again. Like Survival Games for example.
They are also used for Competitive games, like Fortnite, Counter Strike, Overwatch, but there is usually a bigger backend in place to automatically spin these up etc., which is a lot more involved and has high hosting costs.

ListenServers are players that are acting as Servers. This allows them to cheat but you wouldn't need the Source Build and you wouldn't hae hosting costs.

quasi tide
#

That's just how networking works.

#

Otherwise you need some kind of relay server - which is where stuff like Steam or EOS come in.

wheat rose
#

@thin stratus do you have like 5 mins to jump in a call and explain how i do what you said earlier by chance?

quasi tide
#

They don't.

thin stratus
#

Absolutely not, sorry.

blissful lark
quasi tide
#

Your router

wheat rose
#

gotcha just checkin 🙂 ill figure it out thank you guys

blissful lark
quasi tide
blissful lark
#

because my internet dosnt work with port forwarding its a WHOLE thing with my internet provider

thin stratus
#

If that's not an option for you, then you can already start planning for Steam or whatever else allows you to host without having to do that.

blissful lark
#

wait should i get dedicated servers if im wanting to make a battle royale game?

quasi tide
#

Depends. Maybe your BR game is only 4 people.

thin stratus
#

All I allowed myself today was watching 2 episodes of Scrubs with my wife.

#

Then I went to bed.

#

;_;

quasi tide
thin stratus
#

Very good. I got Stargate SG-1 and Atlantis for my Birthday. Nothing beats the older series.

blissful lark
#

does anyone have videos for dedicated servers

quasi tide
thin stratus
#

Also this will cost a fortune in hosting costs.

#

And yes, don't do a BR game please. This is way over most peoples heads.

blissful lark
#

ok

#

you got any ideas i should do then

thin stratus
#

Coop Games, like Duro wrote.

#

Something you can play with ListenServers.

lament flax
#

how do you do console commands that works for Uobjects ?
exec commands using UFUNCTION are easy but you cant name them as you want, cant give tooltip

thin stratus
#

The Multiplayer part for that will be difficult enough.

thin stratus
lament flax
#

i get weird issues

thin stratus
quasi tide
#

With pvp stuff, you actually have to consider cheating. And more accurate hit detection. So much extra work.

lament flax
thin stratus
#

A proper BR game probably needs a 2 to 3 digit sized team at least 2+ years.

#

If you cut a lot of content and close both eyes you could get away with 1 /4 of the team size and a year of development.

quasi tide
#

Can probably find some YT video that made FN in 6 hours though. BP only as well.

thin stratus
#

But you'd probably also end up with a dead game :D

thin stratus
quasi tide
#

Whatever the issue is, could also be because of one process mode.

lament flax
#

im registrating this in character ctor

FConsoleCommandDelegate::CreateWeakLambda(this, [this]()
        {
            bDisplayDebugWindow = !bDisplayDebugWindow;
        }),

when bDisplayDebugWindow is true, on tick a ImGui window pops up with data collected from the character.

when i call the command on listen server, it displays the window and data correctly
when i call the cmd on client, it displays the window, and the listen server character data is somewhat used

lament flax
thin stratus
#

We usually have a Player Selector Widget in ImGui to select the different Pawns on different processes etc.

#

If you change Console Variables I'm pretty sure they change for both sides anyway.

#

We don't open the windows with that.

lament flax
#

so i got this issue for everything, imgui windows, debug draws ...

#

my only possibility is static variables ?

thin stratus
#

Idk, sounds more like you need to figure out what Player you want to draw debug information of.

wheat rose
#

OKAY i actually managed to get it working. However I have a system setup so that when you shoot a prop that Isn't the player you take damage, once you reach zero you die and if no hunters left the game ends. HOWEVER, that system for some reason only works for the Host. How can i resolve this. can send screenshots if needed

#

making me go crazy

quasi tide
#

May not be replicating stuff correctly.

#

But showing code would be helpful. For both parties.

dark edge
lament flax
dark edge
#

input -> the shot -> the hit -> the damage -> the game end check

wheat rose
#

small screenshot spam then

dark edge
#

say which class each bit of code is in too

wheat rose
#

Shoot - BP_Character (PARENT)

dark edge
wheat rose
#

here?

#

under BP_CHARACTER_HUNTER, child of bp_character

dark edge
#

yup thats your first problem

#

the server doesn't know you shot

wheat rose
#

if i shoot the prop (aka the other player) it eliminates them and the round ends fine though

#

whether u r client or host it works on both

thin stratus
dark edge
#

this code is a mess lol

wheat rose
#

im starting from a template, also the most recent screenshot is from the parent class

dark edge
#

This is sus, it's always gonna be the host

#

the instigator isn't the hosts PlayerController, it's ThisPawn's PlayerController

wheat rose
#

hmm oke

dark edge
# wheat rose

modify this to only call Shoot once, and to choose to eliminate the thing that got shot or to damage the shooter

swift sorrel
#

Unsure if I should ask this here or in the online subsystems channel but I'm wondering what's a good way of handling persistent/meta progression for players who choose to play online, without having a player hosting a server? In other words, I'm curious which sort of multiplayer framework I should use.

I want players to be able to play in either solo (offline) or co-op (online, with statistics, persistent character/meta progression saved on a central/dedicated server somewhere) modes (separate options in the menu, of course), keeping player progression separate for both. Should I:

  • have players create listen server sessions and periodically upload their progress (authenticated) to a dedicated server while playing during the sessions?
    OR
  • have players join a dedicated server/one of several dedicated servers - through matchmaking or some method of joining friends - where the dedicated server will handle all the progression stuff directly?
    OR
  • some other suggested method?
    (In any case, singleplayer progression will of course be stored locally on the player's computer and be completely separate from online progression.)

The reason I ask is because I'm not sure if I should be digging down the dedicated server rabbit hole, but I'm also not designing my game with listen server networking in mind as I prefer the server to be headless and not hosted by a player. Perhaps I can be convinced otherwise.

random verge
#

If the progression matters, an authoritative dedicated server calling the shots is the only way. If it doesn't matter, player hosting can save lots of $$$

#

anyone dig into this MultiServerReplication plugin yet?

#

expectations are fucking flatline but kinda curious

lethal wraith
#

Hey, If I call a reliable server rpc and then call another reliable server rpc, is there a possibility that the later is called first, I am asking this because I am doing some client side prediction stuff and wondering if I could have any kind of bug in case this would happen

dire cradle
#

But if you call the same reliable RPC on different actors it's not guaranteed one would run after the other

lethal wraith
#

In my case it is in an array of structs

#

That also applies to Components then, right?

dire cradle
#

As long as they're in the same actor yes

lethal wraith
#

okay thank you very much

dire cradle
#

I've a strange problem, my pawn's location is sent to the clients even though I have replicate movement off.
I'll make custom interpolation but it constantly overrides my client positions, setting the Net Update Frequency to 0 solves it.
Why would my client position get overriden by the server with replicate movement turned off? (Pawn is not physics simulated)

red mantle
#

hello can anyone help me i have multiple different character blueprints and want to spawn a random one when the player connects

wheat rose
#

@dark edge ok its running under one Shoot now

rich geyser
#

I'm looking at some code that is crashing because of an invalid this pointer, in a member function that's being triggered by a delegate after a map load has started following a network error. I thought this kind of thing wouldn't happen because the delegate's reference to the object would keep it from being garbage collected before the delegate's owning object. But now I'm not so sure...

verbal ice
#

They will not keep an object alive

exotic wasp
#

either need to unbind on the objects death or use AddWeak methink

rich geyser
#

ah, well then that makes sense

dire cradle
rich geyser
#

Gonna have to tell the owner of this code to change it then

#

@verbal ice @exotic wasp thanks!

exotic wasp
verbal ice
#

I'm guessing Zinac is passing more UObjects as arguments to the binding, right?

rich geyser
verbal ice
#

Can you show code? That's pretty weird then

exotic wasp
#

what is CreateUObject()?

verbal ice
#

FSomeDelegate::CreateUObject

#

for single target delegates

exotic wasp
#

ahh

rich geyser
#

yeah that. But also I just found ::CreateLambda

verbal ice
#

If you're dealing with UObjects, you should use CreateUObject

#

or CreateWeakLambda at least

exotic wasp
#

lambda definitely will not hold a weak reference and will happily dereference trash

rich geyser
#

yep this is it

hollow horizon
#

Am I allowed to post video in here, I need some feedback and that stuff to show just abit of my work in the past 2 days haha

verbal ice
#

CreateWeakLambda(TheUObject, [TheUObject](){...}

exotic wasp
#

assuming you dont want a named function yeah

hollow horizon
#

@verbal ice thanks mate I did upload but not had any feedback I'm new tbf and I'm kinda proud of it so far

rich geyser
verbal ice
#

Yeah not good

#

Just pass this as the first argument of CreateWeakLambda and it'll fix it

exotic wasp
#

ahhh yeah

past flicker
#

Anyone have issues with OnLanded being flaky? Sometimes it just doesn't get called even when I watch my character fly through the air and hit the ground. I suspect it has something to do with corrections, but I'm not sure.

grand kestrel
#

@thin stratus I think I found an issue with my modifiers. When corrections occur it can rewind the start/stop modifier event, and when replaying the move it isn't being called again 😦

verbal ice
left lance
#

Are OnRep variables suppose to set prior to BeginPlay executing? I’m testing with bad emulation and sometimes when I add a client, that client will execute BeginPlay first on that actor component and then OnRep. Then I’ll add a second client and it’ll execute OnRep first for the variable on that same actor component and then the BeginPlay.

Is this just the way it is? I was hoping it would always execute OnRep before BeginPlay

verbal ice
#

rep notifies can be called before BeginPlay and vice versa

left lance
#

Like I always assumed the moment the variable was replicated OnRep was called. But I also assumed OnRep occurred prior to begin play

verbal ice
#

Yes, the variable being replicated is why OnRep is called before BeginPlay

#

If the repnotify is called the variable got replicated

#

You have a nice guarantee with the engine: initial replication of a UObject is guaranteed to have all of its unmapped replicated properties available

#

By unmapped I mean any replicated property that isn't a UObject

#

You just have to handle the rep notify and BeginPlay being out of order in your code

left lance
#

Also, if you pass a variable via constructor that is a replicated variable, then in that case, the replication must come through prior to begin play - correct?

#

I think I’ve done that in the past 🤔

verbal ice
#

If you have an actor, with the following replicated properties:

int32 SomeNumber;
FString SomeString;
UObject* SomeOtherObject;

When the actor is initially replicated to a client, you are guaranteed that SomeNumber and SomeString will have the replicated values ready. SomeOtherObject however may or may not be there yet.

left lance
verbal ice
#

This is because SomeOtherObject is a reference to another object that requires mapping. If the other object isn't available on the client, the value won't be there.

verbal ice
#

Not entirely certain before BeginPlay

#

At the very least the rep notifies might not have been called yet

#

Another guarantee is that, on a frame when an actor is replicated, all of it’s changed properties will be sent at once, and the client should receive and apply these changes within a single frame (with the exception of unmapped properties). However, there is no guarantee made regarding the order in which properties will be received or the order in which OnReps will be called. Any order is considered an implementation detail that should not be relied upon. If the order of an actor’s property replication is important to your game, you may need to implement OnReps to track which properties have been updated on a frame. After the replicated values have been received and their OnReps called, you can handle the changes in the PostRepNotifies function. You may also need to save certain received values in their respective OnReps until they’re ready to be used.

left lance
#

Ok, I think I’m understanding it - thank you so much! I’ll also read up on that article 🙂

red mantle
#

im unable to move due to enchanced input mapping when spawned how do i fix this ?

verbal ice
#

show code

red mantle
#

its just the default third person

#

but only the server is able to move

#

client cant move or look

verbal ice
#

I think the client variant is AcknowledgePossession

#

or OnPossessed on the pawn

#

something like that

red mantle
#

could i change event possed to a custom event and call it from spawn player ?

red mantle
verbal ice
#

You have to do it on the client though

#

Not the server

#

Without knowing more about your setup I'd say to just do it in BeginPlay in your player controller, check if it's on the client side and you're good

dire cradle
#

I've a custom movement component that works fine in the editor, the client mode works correctly. Even on bad network emulation it doesn't break.
In standalone build it also works fine. But when I test it in a dedicated server it blows up

#

Are there stuff I cant do in dedicated servers? Why would this happen

#

Only happens in the dedicated server, listen server is also fine

#

why :c

#

sometimes I want to uninstall unreal

dark parcel
#

Describe what blow up or doesn't work?

dire cradle
#

Ive an edge detection function for custom navigation mesh, it works fine on standalone and listen servers but for some reason returns null on dedicated servers

#

Im suspecting the dedicated server is interpreting some warning as an error and acts extra dramatic when it doesnt need to

#

Ive been trying stuff for 4 hours now with no success

swift sorrel
#

put prints everywhere and identify the break point

dire cradle
dire cradle
#

Only in the dedicated server it breaks, I already know which function is causing it but theres nothing wrong with it

#

Can dedicated servers not perform cpu access on static meshes?

#

That's all I can think of, I need mesh data for edge detection maybe thats what's failing

swift sorrel
#

and do you mean in PIE it works but in standalone game it doesn't?

#

because standalone networking mode and standalone game mode are two separate things

dire cradle
#

In PIE it works, the standalone build works, when you connect peer to peer (listen server) it works
But when you connect to a dedicated server it doesnt work

swift sorrel
#

ok so Client networking mode doesn't work?

dire cradle
#

Client networking mode in the PIE works

#

There are no networking issues, something breaks only in the dedicated server

swift sorrel
#

ok so doing the actual connection to a dedicated server you've set up breaks something?

dire cradle
#

It's not a networking or a connection issue, the problem is the code breaks only in a dedicated server build

#

It's the exact same code that runs in a standalone build or in a listen server

swift sorrel
#

I would say it's fair to assume it's a networking issue, because otherwise it wouldn't be affected by how you start your session

#

there are some things that behave differently even between PIE and Standalone Game modes

#

because of the order of operations for initalizing certain things like player controllers and pawns

dire cradle
#

Im aware of that and that can't be the problem because there are no problems in listen server configuration in a packaged build

swift sorrel
#

you might have to do some work in the game instance and/or game mode classes, if you don't already have custom ones

#

listen server is not like dedicated server. dedicated server is headless and does not depend on a player to host the server (in which case, if you are the only one testing listen server, you will get different results compared to testing with multiple clients in listen and dedicated server setups), though I'm sure you're already aware of that

#

hard to really say what should be done without a more in-depth explanation of the issue, or without digging into how your game is built, I suppose

dire cradle
#

I know, same result with multiple clients

#

There's a server side calculation that's going wrong only in dedicated servers

swift sorrel
#

but back to my original suggestion; prints everywhere. do they not show up in builds? you might have to log the prints on the dedicated server itself

dire cradle
#

I'm making a build with a shitton of logs everywhere now, hopefully this time it will provide some insight

swift sorrel
#

good luck. sounds like a tough issue to identify

boreal flicker
#

im trying to make a multiplayer movement shooter to play with my friends in blueprints (i dont have enough braincells to learn c++). im trying to replicate a movement mechanic that involves being launched at high speeds across the ground. it replicates and i made basic client prediction so there's no input lag, but i dont know how to correct the client smoothly and i dont want the regular rubberbanding to happen

thin stratus
#

In theory that is sadly not really possible with Blueprints. Cause you'd need to code that mechanic into the Character Movement Component

boreal flicker
#

can i make the normal rubberbanding smoother somehow?

ancient adder
#

What parts of the engine net code is not suited for high player count? CMC or everything starting from where the engine gathers actors for a connection to replicate to in NetDriver?

I'm trying to avoid reinventing the wheel with my custom net code and use what is already there that is efficient and replace or extend what is not

I understand I need to profile, I did some tests and profiling in the past and I recall CMC was the killer, But forgot if there was something else that needs replacing due to taking a long break from programming in general, Also lesson learned, write down the tests and profiling results next time

lament flax
#

CMC is heavy by default, you can tweak some settings to reduce bandwidth usage, for frame time idk what can easily be done to reduce its length.

thin stratus
#

But you can't get rid of it entirely. Main reason is that you would usually need to send a flag (or a boolean) via the ServerMove RPC of the CMC to the Server, which then is also kept locally in a SavedMove.
When a correction comes in, that SavedMoves allows the Client to replay every move that hasn't been acknowledged by the Server yet.

But since your custom movement doesn't have that input, or any of the data that is usually needed to be kept there, in said SavedMove, it can't replay it and then you get strange results.

boreal flicker
#

ok ill try

thin stratus
#

(i dont have enough braincells to learn c++)
Also, just to encourage you a bit (or maybe this has opposite effect?), Multiplayer is potentially more difficult of a concept than C++.

rotund linden
#

I'm trying to replicate the movement of a boat. The boat is a pawn and I'm using a custom buoyancy system. It uses add force and add torque to move. When testing in both the editor and a built version I notice consistent lag and jittering on the client while the server behaves normally. Without network emulation the issue is already present and when I set the network emulation to bad the movement becomes completely broken and unplayable.

The boat's root component is a static mesh with Simulate Physics enabled. I’ve tried Replicate Movement and RepNotify, but neither worked as expected. I also tried to run physics on the server, experimented with unreal engine's built in Physics Replication Modes, and integrated Smooth Sync, but the jittering persists.

How can I achieve a smoother boat movement

dark parcel
#

Correction stops the current montage of the character. Is there a way to not do that?

#

and is there a setting I can change to increase the treshold for the correction?

#

Kinda butting my head againts the wall to do attack montages.

#

I mean logic wise, it's as simple as
Ability Activate -> Client play Montage
Server Ability Activate -> Server play Montage

#

but I keep getting mini correction that totally break my anim

grand kestrel
grand kestrel
dark parcel
#

PlayMontageAndWait from GAS 😦

grand kestrel
#

Yeah that shouldn't have a problem

dark parcel
#

hmm

grand kestrel
#

You're using a local predicted ability? Not running separate logic for server?

dark parcel
#

Im predicting the activation

grand kestrel
#

As in the only thing you have is ActivateAbility -> PlayMontageAndWait

dark parcel
#

but the server eventually call the same func

dark parcel
grand kestrel
#

Oh then your prediction key is probably getting rejected entirely, and the ability never ran according to the server

#

That's the only reason de-sync would end the montage

dark parcel
#

Toggling this stops the montage from ending

#

but I get correction again when turning it back on

#

and the Abilities run on both side I believed, since I can see the attack montage playing in both server and client

upbeat basin
#

The amount of non cmc/physics based movement questions here recently make feel like I'm falling behind a trend or missing some core knowledge that I should be knowing

dark parcel
#

could it be the motion warping?

grand kestrel
#

Sounds like its related to how you're triggering the ability

dark parcel
#

🤔

grand kestrel
#

You will need to debug

#

Server is ending that ability and rejecting it

dark parcel
#

i will look for something

grand kestrel
rotund linden
#

I'm not someone who could rebuild cmc from scratch and probably using cmc would require me to change the boat completely

cold cipher
#

using steam online subsystem
pretty sure it's up because the steam layout did popup when shift tab
but when I play in standalone mode find sessions advanced failed
does anyone also had this problem?

upbeat basin
#

I'm not familiar with advanced sessions plugins but could be due to how you configure your session settings or subsystem (ini file). What kind of options does it have to create a session?

dark parcel
#

Where can I even find a good source that uses GAS in multiplayer correctly?

Lyra breaks down with high ping and tranek's example project doesn't even replicate a lot of things.

#

even the reload is not replicated 🤔

upbeat basin
dark parcel
#

Nvm movement

#

But the reload isn't replicated

tardy fossil
cold cipher
dark parcel
#

Lyra is also a garbo project. How is it meant to be the standard. Play with 125 ms and things break right away.

dark parcel
#

Can't run 2 instances in the same computer and join each other.

cold cipher
#

the other players only need to see your reload animation (probably)

dark parcel
#

@cold cipher I'm just ranting about GAS documentation project

#

multiplayer is hell

signal geyser
#

Any idea on why my character would be stuck in t-pose on match start on client if I increase net priority on player controlled characters?

modest crater
marsh shadow
#

i want to make a multiplayer game but i want there to be zones that will load and unload on client side

#

i tried data layers,but the way it's done

#

is i can either have the server turn the layer on/the client turn it on,but only for it self and if i have collision on it,it would be diffrent from the server so it would not work correctly

signal geyser
marsh shadow
#

i'm wondering if the world partition is a good option for this,but i guess it's totally on the distance of the player controller

signal geyser
exotic wasp
#

the only times you'll have to custom make things afaik is getting specific data from client-server or with CMC

grand kestrel
grand kestrel
#

What you're seeing is almost certainly specific to your project and not an engine issue tho fyi

lament flax
#

for correct CMC movement replication with the character capsule, am I forced to use AddMovementInput ?

#

how would it work if i want to snap the player to a surface (climbing cylinder surface left and right)

grand kestrel
grand kestrel
lament flax
grand kestrel
lament flax
#

well i guess its way hard then i thought

#

i ideally wanted to temporarily hardcode something

grand kestrel
#

Hardcode isn't a term that has any meaning in this context
If you want something quick and dirty then do it in SP via BP
There is no quick MP solution

swift sorrel
#

not recommended unless you know exactly what you're getting yourself into

#

it's difficult even for most professional devs. most physics stuff is relegated to cosmetic things that don't affecte gameplay, generally

swift sorrel
#

example of advanced sessions node (left) versus default online subsystem session node (right)

#

(on top of that, most of the relevant properties have actual informational tooltips)

wheat rose
#

Hi 🙂 I need help with a system i have. So i have it so when you shoot props that arent the other players hiding as props you take damage, when you reach 0 health you become a spectator. However, that only works for the host and not the clients, when they reach zero nothing happens. any help would be great 🙂

quasi tide
#

What was the result of yesterday during your help session?

sinful tree
quasi tide
#

What did you change from that time period?

wheat rose
#

I was able to get health and such working for both the host and client, was also able to get the host to become spectator when they die. However after a bunch of trial and error i didnt reach very far. I am very bad with blueprints and not very knowledgable so being able to get something working has been hard xD

#

@sinful tree what do you mean by make sure the host is the one managing the damage? the damage is being held by the Server rn, is that what you mean?

sinful tree
#

Any damage that is applied needs to be applied by the server to ensure that a client's character is properly being damaged. If you're sure that the server is the one applying the actual damage, then when the actor is dead, and assuming your damage dealing code is within a pawn (or character) already, it should just be a matter of spawning the spectator pawn, getting the controller of the pawn where the damage was applied and making that controller possess your spawned spectator pawn.

#

If you're using something like "Get Player Controller 0" that's the wrong node - you want "Get Controller".

wheat rose
#

that would be plugged in under possess right?

#

the get controller?

#

also, where should that be handled you think ^ i currently have the turning into spectator handled in the GM

sinful tree
#

Yes, controllers can possess pawns.
It doesn't matter where you call possess, but you need to ensure when you're spawning the spectator pawn that it is being possessed by the controller whose pawn was defeated.

wheat rose
#

so would that be a get player pawn?

sinful tree
#

No

#

Are you using the built in damage system where you call Apply Damage and then implement the "Any Damage" event?

wheat rose
#

yes

sinful tree
#

Ok, so that means that Any Damage event is in the pawn that is currently possessed.

wheat rose
#

yes

sinful tree
#

You can get controller of that pawn. You can pass that controller reference to a function in your game mode to then do the spectator pawn spawning and possession.

wheat rose
#

oke cool i got it to work for the client, but the body remains in the scene after possessing the spectator. i know there is a destroy actor but idk where id put that in the line

#

unless it could be handled better @sinful tree

sinful tree
wheat rose
#

fantastic, now i just need a way to make it so that when there are no more hunters, the hiders win

#

but thank you for simplifying that, ^ its working now, just need this system to work and im all good 🙂 @sinful tree

dark parcel
# exotic wasp what are you having issues with in GAS? replication should be fairly easy

My attack montage keep getting cancelled from what seems to be correction. If I untick correction, my montage will keep playing but switching back on cause huge correction.

I suspect waiting for target data to be ready may cause de-sync. Since the rpc can come anytime. Maybe it's the delta time between waiting for target data and the execution of montage that cause de sync. I have no idea at the moment.

gritty mason
#

Hi guys. I want to make a replicated Anim montage event, but I have a really strange bug. When my character on the server push, doesn't update the movement on the client.

#

On the Left Side is the Client, on the right side is the Server

#

At client everything works well

#

Anyone has a solution please? Thank you.

dire cradle
#

Which one is the client in the video

gritty mason
gritty mason
#

At Client the Server movement doesn't refresh

#

I use the motion matching project.

dire cradle
#

How does the animation pull the player velocity/input? I think it might be the one that's getting stuck

static owl
#

I’m so frustrated. Game works fine in the editor, but then I package it, and run it with my friend. All of a sudden when my friend disconnects (as the host), it doesn’t send me back to the lobby like it does in the editor. I have it set on network failure to do that, but it just spawns my character outside of the lobby falling.

THEN I created an AI, with a behavior tree. The animation montages are not playing on the clients, but they do on the server.

It’s just so incredibly frustrating because it takes forever to package the game, send it to my friend, have him run it and I run it, after making 1 change to see if something is working now.

Is there a better way?? How would I even begin to debug?

dire cradle
#

Just calling play montage would only play on server, you have to play them on everyone by multicasting

static owl
dire cradle
#

You can also run the editor on listen server configuration and test it before packaging

#

Some stuff may still act differently on packaged builds tho

static owl
#

Whenever I test, I usally run as Listen Server, and then check both the Client and server to make sure its working, then i usually play as both clients, and it still works. But when I package its broken.

dire cradle
#

Don't play montages directly in the behavior tree task, call an event on the actor that will play the anim

static owl
#

Just to give you context. This is a character who runs on a loop every 15 seconds to do a quirky action (its normally a 40% chance, but for testing i have it at 100%).

In the behavior tree, it checks to see if the chance was enough to do the action, then grabs a random number between 0-4. This corresponds to one of the tasks.

(Complain, Punch, Dance,etc). The Run off task works correctly because its just ai move to. The Punch task works and replicates, but its a little different because it calls custom events that are on the characters themselves.

#

Wow lol read your message as i pressed send. Let me see if that will work.

dire cradle
#

Yeah the punch replicates correctly because the task is calling it on the actor, not directly trying to play montages on it

#

Dont put gameplay critical stuff on behavior tree tasks, make them call the events instead

static owl
dire cradle
#

You could just use a dispacher

static owl
dire cradle
#

It would work but that's more like a hack than a solution

static owl
#

Agreed. Let me look at the dispatcher!

#

Also, in the editor, as client and server it does correctly replicate now.

Once I get the dispatcher working, then I’ll have to package and see if it works there.

If it does, I can move on to my next problems lol!

dire cradle
#

You could also have a flag or a gameplay tag that indicates if an action is already being done

#

The tree would just check that (before executing anything else), you wouldnt need to use a dispacher either

static owl
#

Like this?

this is when i set my character as Downed, I needed it to not attract any monsters. So when they see my character and he has the downed tag they do not follow him or damage him.

dire cradle
#

Kinda yeah, but using gameplay tags for those things is safer

#

with a string array you might get some race condition problems

static owl
#

Oh okay, I haven’t used gameplay tags quite yet.

I’ll try to go look into that, and figure out how I can implement it into the tree.

#

Thank you for the help

fervent delta
#

I have a question about MMO architecture, not that Id want to make one just love knowing how things work, is what I have below the general gist of it or am i way off

game launcher
-> user logs in with email/password (or some other auth)
-> launcher posts to login server
-> Login server looks account details up
-> Login server responds with a auth token

game launcher launches game with token as parameter
-> first game map requests user and server information using auth token
-> login server responds with region and user information (such as user_id)
-> game populates widgets with servers/regions
-> user selects server in a region and the game connects to this server

Region server is just a main menu with character creation/management
-> Region Server accepts incoming connection
-> it requests the user ID from the login server using the auth token
-> it uses the user id to look up characters in its own DB with the users ID
-> user creates a character, the region server will add a new character to its own DB
-> User selects a character, region server already has this character information, such as last known location/rotation
-> region server selects a cluster GAME server based off this location (e.g. its cluster 4 part of the map)
-> region server knows we have several fragments currently up for this server with fragment 5 being the lowest populated
-> region server will connect to cluster 4 on fragment 5

Cluster 4 fragment 5 accepts incoming connection
-> It requests the character information from the main regions API
-> it loads in the character at said location and rotation
-> every time the character updates (or can be run as a job in the background every so often) it
will post to the main region api updating character information.

fervent delta
# fervent delta I have a question about MMO architecture, not that Id want to make one just love...

And some more info explaining what i mean above

Login server is just an API with a database

Region main server is an API, DATABASE and single game instance of a character screen level.
it can have several clusters and each cluster can fragment up several mirror images of itself,
clusters and fragments can be spread across seperate datacenters and on virtual machines or dedicated servers or all on the same machine.
each one talks to the main region servers API which updates said DB.

dire cradle
#

My only question is why would you need an entire game server for just handling lobby related stuff like character creation

#

That could just work on client side, you'd connect to a gameserver when you already have created and selected a character

#

You can fetch/send the character data to your API from client side without needing to connect to any server

fervent delta
#

yeah true, just use the region api for the character info.

#

then on character select have the api return a cluster/fragment ip

dire cradle
#

yeah it eliminates a lot of ambiguity, the simpler it is the better

fervent delta
#

so essentially what I have up there looks right, the region api server would also have to have another service running in the background which would spin up new fragments (based off total connected players and a max count). and a fragment is just a game server instance.

dire cradle
#

yep that'd work

#

it's just a server manager

fervent delta
#

yeah thats awesome. haha

gritty mason
#

I have no idea how to solve it... If the play rate 1,0 , work properly, but the character is stop the movement. I want the character to be able to push while moving.

#

If I pull the play rate from the traversal, the character can push while moving, but the server animation only gets stuck on the client screen.

dire cradle
dire cradle
# dire cradle Can dedicated servers not perform cpu access on static meshes?

This was it. For anyone planning to do some dedicated server work, Dedicated Servers cannot access mesh sections! They seem to only have collision data!
I solved my problem by baking the mesh sections into a data asset in the editor before packaging.

(And it doesn't even put up a warning or an error saying it doesn't have it, simply returns an empty array as a middle finger and refuses to elaborate)

dire cradle
swift sorrel
#

No problem! did you figure out what you needed?

swift sorrel
#

Doh, didn't read it yet. Good to know!

#

Quite a quirky system😅

dire cradle
#

Yeah, but at least baking the section data should also have some performance benefits, not sure if it was worth the 2 days of headaches though

#

I still have a problem with the pawn replicating its position even when Replicate Movement is off though

#

I can't implement client interpolation because of it, movements in the client side look choppy.

#

Why is unreal so stubborn

grand kestrel
#

i.e. you could/should? probably do the same

dire cradle
#

wait, sim proxy mesh?

grand kestrel
#

So the pawn that other players see (i.e. not the one you're controlling)
It takes the mesh from that pawn that represents them
And smooths the mesh's translation/rotation

#

i.e. smooth the mesh between the last actor location to the new actor location
Well, you wouldn't do a lerp which that phrasing kind of suggests, because you don't know when you'll receive the next, you just interp towards the current

#

You could look at how CMC does it

#

I really dislike how they tied both translation and rotation into a single net smoothing mode tho, should have a setting for each

dire cradle
#

So I shouldn't try to interpolate the actor position, but the meshes inside of it?

#

Wait I was already doing that for the player camera, yeah that makes sense to apply to other stuff as well

swift sorrel
swift sorrel
#

it should always be Client presses button (movement in this case) > server confirms that client sent the command, sends command to all other clients It could perhaps also be that you're changing movement variables like movement speed, but those aren't getting replicated. RepNotify is your friend in this matter

dire cradle
#

No that's not the issue, it's the opposite. I wanted the actor position to NOT be replicated

swift sorrel
#

For what reason?

dire cradle
#

Even with replicate movement flag turned off, unreal force replicates the transform

swift sorrel
#

But it's choppy?

dire cradle
swift sorrel
#

choppiness is usually the result of the server taking authority over the client when it comes to replication (in this case, position snaps to server's position each server tick)

#

if you want it to smooth out on the client's side, you could probably just extend wherever the movement is coming from to also play on the client simultaneously

dire cradle
#

The issue is I can't do that very easily, I'm using a custom nav mesh for spaceship interiors that players walk on. And that mesh is constantly in motion simulated by the server.
So it was best if the engine didn't do any automatic movement replication at all, because it clashes with my system

#

Turning off replicate movement sadly doesnt have any effect and it still overrides my positions

#

I think I'll just surrender and do sim proxy mesh interpolation instead like Vaei said

dire cradle
#

After

#

Both are clients, with average network emulation

#

Im so glad it works smoothly now, thanks @swift sorrel & @grand kestrel for the ideas

static owl
#

I am having trouble with the error Accessed None, when trying to get my widget reference (Health Bar). I am having the same error with the ABP reference, but I moved it up in the timeline of initializing things, and added a small delay to referencing it somewhere else in my character. (Still having the same issue).

Not sure what I should do here for the W Hud Reference!

upbeat basin
static owl
dark parcel
#

Why on earth do you need a reference to the anim bp.

#

Your system should work without it and also why is it a replicated variable.

#

The instance don't replicate

#

Also there's no guarantee that they are already replicated even if it can be replicated.

#

The only time you can ensure something replicate is with rep notify

static owl
dark parcel
upbeat basin
#

For the things you could look into about

  • Widgets and ABPs don't replicate, setting their variable as replicating is useless and won't work
  • You're setting those replicated variables on client. Yes they already don't support replication but even if they did, it still wouldn't work, you need to set replicated variables in server and server replicates the latest value to clients, that's how it works
  • You don't need to send client RPC on Posessed event, client should also have a function that gets triggered when the pawn is possessed (don't remember the name or if it was available in BPs though)
  • GetHealthPercentage function.. is weird. Pure functions aren't just cosmetics to make them work without the white pin, they get executed for every pin they are connected for. So it's better to make them little to nothing (like just returning the value) or change the name fitting to the context and make it non pure (just a suggestion)
#

This is a tutorial? wow

dark parcel
#

Bp multiplayer tutorial in youtube is peak garbage

#

With thousands of victims thanking shitty broken codes

upbeat basin
#

If they're able to earn money or reputation with these, I'm getting in as well. Easier than trying to do something right lol

dark parcel
#

At least his content is pretty good. I would say on par with Tom looman

static owl
# upbeat basin This is a tutorial? wow

Hey guys, in today's video, I'm going to be showing you how to set up a knocked down and revival system. This is also replicated and works for online multiplayer too. This is part 1 of 2.

Part 2: https://youtu.be/_hlnD4M0Lsc

Animations: https://matt-aspland.itch.io/downed-revival-system-animations

Due to not being able to import single frame ...

▶ Play video
nova wasp
#

where in this tutorial does it even say to set a replicated widget

dark parcel
#

1st minute of the tutorial makes me want to close it already.

narrow prairie
#

lol

dark parcel
#

damage already run on server

#

Also why server call damage on client

#

?????

#

K he subtract hp with client rpc

#

Just close it man, garbo turorial

upbeat basin
#

That's it, I'm releasing all my missing and partial knowledge to public from now on

dark parcel
#

This is just one of shitty tutorial

#

You should see someone spawning with multicast

#

And everyone went omfg i finally get it to work thank you

narrow prairie
#

everyone gotta learn somewhere man 😛

dark parcel
#

Not youtube where they teach you the incorrect way.

static owl
#

I apologize if it’s a little hard to read. But that’s the full function.

So I need to remove the replication from W HUD ref, and the ABP ref?

And event possessed should go directly into the cast to player controller, instead of calling the “client create UI on the custom event”?

dark parcel
#

I don't mean to attack all content creator

static owl
upbeat basin
# static owl I apologize if it’s a little hard to read. But that’s the full function. So I ...

Eh I don't like myself for saying this but you might need to learn the basics first, even trying a singleplayer first to get familiar with the engine and then multiplayer to split their complexities into 2 different learning paths.

If you're just new and trying to do this specific thing, to get your hands warm, try to replicate the video as is for now, get adjusted to the editor and stuff a bit. But be aware this is not a tutorial that will teach you something that you can use in the long term. Please unlearn everything in the video later

#

As for the question though, ngl I still am not sure why you get null ref from trying to use HUD, you seem like set it before you try to access it

dark parcel
#

I'm on the brink to go back to single player

static owl
upbeat basin
#

Since there isn't any actual replication is going on, no there isn't any need for delay or being sure that the variable is initialized. You apparently do that in Client_CreateUI, before calling GetHealthPercentage which is where it's being used

#

Maybe you can try to put breakpoints where it's being set and where it's being used to see if you call the function from somewhere else before you get your possess though

#

Are the error messages printed only when you press the U key?

static owl
#

If its any use at all, If I play as 2 Clients, Client 1 Can see his health correctly and it doent cause an issue, but Client 2 doesnt even have a health bar lol

#

And yes! U dmgs the player for 10 health

#

Thats when the errors occur, or when dmg is taken

upbeat basin
#

How do you deal the damage?

static owl
# upbeat basin How do you deal the damage?

Looking back on the tutorial, it had me create the widget in my player character. One of the issues I was running into was that when I spawned In the lobby with my friend on the test build we could see each other go into the downed state, and our health bars worked fine! But when we server traveled to the next level, his health bar disappeared and the downed state wasn’t replicating correctly.

So do you think moving it to the player controller will fix the issue? Since it will not be destroyed like the player character is?

dire cradle
#

Moving it to player controller would probably work

#

But can you try this first:

dire cradle
#

This isnt a solution just a hack to see if it's a timing issue

#

Sometimes stuff don't get loaded/spawned yet on clients when they are already assigned on the server. So that may create timing problems that lead to null refs

#

Wait

#

Why is your widget variable set to replicated?

#

If that runs on a listen server the variable in client will be overriden by the server's hud, which doesn't exist in the client. That can also lead to a null ref

#

nah nvm it's was in a client rpc that shouldnt happen

#

You still don't need to replicate widget variables though, they only exist locally anyway

upbeat basin
waxen socket
#

Hello, I have a question about replicated timeline components. 👋

Are replicated timeline event track triggers reliable? Will these execution pins always eventually fire on the client?

Any advice would be appreciated. 🙂

Cheers.

dire cradle
#

I think it only replicates the play rate, play direction, current time etc so it's synced to clients when it plays

#

I wouldn't rely on them

waxen socket
#

Thanks, Spynora. I think it does fire them but I don't know if it's stateful so I guess I'll just move that logic to an RepNotify. 👌

daring gorge
#

hi does enhanced input have to be set in a way to make it work for networked games?
whenever i join as the client this returns invalid

dire cradle
#

it's client sided

#

run it on client it should work without any extra work

daring gorge
#

i did try to, didnt, let me try again

#

the client rpc doesnt even fire up

lavish perch
#

Hey is it possible to do something like this:

Create a macro to reduce my redundancy when creating a lot of replicated properties that all do the same thing OnRep?

I ask because it seems not to work, I get this error Failed to find Property CameraZoomSpeed when DOREPLIFETIME_CONDITION_NOTIFY(ACorpPawn, CameraZoomSpeed, COND_None, REPNOTIFY_Always); is called.

// Macro to simplify property declarations
    #define DECLARE_PAWN_PROPERTY(Type, Name) \
    UPROPERTY(replicatedUsing=OnRep_##Name, BlueprintReadOnly, Category=CorpPawn) \
    Type Name; \
    UFUNCTION() \
    void OnRep_##Name(Type Old##Name) \
    { \
    HandlePropertyChanged(GetClass()->FindPropertyByName(GET_MEMBER_NAME_CHECKED(ACorpPawn, Name)), Old##Name); \
    };
    
    // Declare properties using macro
    DECLARE_PAWN_PROPERTY(float, CameraZoomSpeed)
    //... Declare more properties
    
    #undef DECLARE_PAWN_PROPERTY
tardy fossil
#

i might be wrong but i dont think UHT allows you to define UPROPERTY variables through a macro like that

lavish perch
dire cradle
daring gorge
dire cradle
#

how are you calling the rpc

shrewd ginkgo
#

I packaged my multiplayer game. the game opens, I open it on 2 different computers and I set up a server on one of them but the server shows 9.999 ms so it breaks when joining

daring gorge
dire cradle
#

It doesn't need to be in an rpc, you can call it on begin play directly

#

try removing the is valid node, it doesnt work on the enhanced input subsystem afaik, returns invalid even when it is

daring gorge
#

reparenting my game mode to gamemodebase from gamemode fixed it

swift sorrel
# static owl Thats where I am confused also. Gonna go and look at my references again. This i...

yea, never depend on delays in that way, if you can. it's a surefire way of having things break later down the line and having to remove and rework stuff that you would have done anyway the first time around. generally if you are getting a null reference, it means the server or client aren't getting/receiving the information properly, somewhere. sometimes it's as simple doing an "is valid" check on the thing you're setting before using it, sometimes it's something you have to hook up somewhere up the logic chain (ie. before setting the HUD variable) that's related to the thing you're setting (usually a controller or pawn reference).

#

I had a case like this which stumped me for a while. it ended up being that I was trying to get a component from a reference to an pawn in a really bad way (using "get component" by index, rather than just getting the component by name directly) which led to a null reference. there are some really weird things with the engine that can change between running in PIE or standalone or cooked build that are hard to track and hard to fix without knowing the pitfalls. in my case, for some reason, the index of an actor's components (position of parent/child relationship of components in an actor's hierarchy) change between PIE and other modes of play, which led to other unrelated issues.

shrewd ginkgo
#

I packaged my multiplayer game. the game opens, I open it on 2 different computers and I set up a server on one of them but the server shows 9.999 ms so it breaks when joining

shrewd ginkgo
#

ty

shrewd ginkgo
#

my English is not enough to understand, can you help me understand how to solve the problem?

#

I tried to have chat gpty summarize it, but it tells me how to prevent high ping servers from being listed in the list, not how to prevent the server from showing ping at a level it should not be.

static owl
#

@swift sorrel @upbeat basin I think I’m going to try moving the Widget creation for the health bar to the Player Controller tonight instead, and see if that gives me better results.

It’s currently stored on the player character.

What do you think about that? Or is there a better place to create and store it?

lusty yarrow
#

Hey, got a design question related to replicated plugins. Whats the correct approach when designing a multiplayer ready plugin? Should the player provide his own rpcs or should the plugin have everything setup already? Should the user have to implement his own rpc calls on the server or should he have some readily available rpcs already in the plugin?

static owl
swift sorrel
#

if everyone needs to see it, you can leave it in the character or move it to the player state while replicating it

quasi tide
#

Otherwise, it doesn't support multiplayer.

crisp shard
#

can you use a rep notify in a packed level actor bp ?

crisp shard
#

specifically to remove a hism instance by index and replicate that

crisp shard
#

i chalked it up to a no, given that the exact same logic with hism's works but for some reason in the PLA it does not

dark edge
dire cradle
#

it's movementing

dark edge
#

I mean did you modify CMC, is it your own system, what is it

static owl
dire cradle
#

It's my own system for walking on custom nav meshes

pale rivet
#

Hi everyone.
Is it safe to set my replicated variable inside of ConstructionScript?
Especially if it is pre-placed actor on level.

Is the variable I set gonna be replicated this way?

dire cradle
#

Afaik they dont run on clients.
You could still set replicated variables in the server and they'd get replicated at runtime after construction, but it wouldn't be reliable

thorn musk
#

Hi, I am having some troubles with the GetCurrentPlayers Node, every other node works here in the screenshot, only GetCurrentPlayers returns 1 always.
Does someone ever had a similar problem?

dawn hearth
#

is it ok to have a timer - with quick interval time of 0.2s - running on server?

red musk
#

Can I do a net multicast from the server instance of GameState? It's acting like I can't, but that seems odd

verbal ice
static owl
#

@upbeat basin @swift sorrel I havent changed any of the code, or moved the health to the player controller or player state yet, BUT I did package my game, and I wanted to see the error I got from the logs and wanted to share with yall! Will work on it more tomorrow.

neon thistle
#

has anyone made anything using the resimulation stuff in 5.5? please share I would like to see how ready it is

#

and can it be setup through blueprints only?

subtle cliff
#

I am testing Subsystem on 5.5 and it is not able to join the session although it found it. Here is my code. Does anyone have any idea? I used the similar structure, but now it is not working here and it returnsEOnJoinSessionCompleteResult::UnknownError
// MultiplayerSessionsSubsystem.h

#pragma once

#include "CoreMinimal.h"
#include "Subsystems/GameInstanceSubsystem.h"
#include "Interfaces/OnlineSessionInterface.h"
#include "Online/OnlineSessionNames.h"
#include "MultiplayerSessionsSubsystem.generated.h"

DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FServerCreateDelegate, bool, WasSuccessful);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FServerJoinDelegate, bool, WasSuccessful);

UCLASS()
class MYPROJECT_API UMultiplayerSessionsSubsystem : public UGameInstanceSubsystem
{
GENERATED_BODY()

public:
UMultiplayerSessionsSubsystem();

virtual void Initialize(FSubsystemCollectionBase& Collection) override;
virtual void Deinitialize() override;

IOnlineSessionPtr SessionInterface;

// Changed to no parameters – the server name is now fixed as "ServerTestName"
UFUNCTION(BlueprintCallable)
void CreateServer();

UFUNCTION(BlueprintCallable)
void FindServer();

void OnCreateSessionComplete(FName SessionName, bool WasSuccessful);
void OnDestroySessionComplete(FName SessionName, bool WasSuccessful);
void OnFindSessionsComplete(bool WasSuccessful);
void OnJoinSessionComplete(FName SessionName, EOnJoinSessionCompleteResult::Type Result);

bool CreateServerAfterDestroy;
FString DestroyServerName;
FString ServerNameToFind;
FName MySessionName;

TSharedPtr<FOnlineSessionSearch> SessionSearch;

UPROPERTY(BlueprintAssignable)
FServerCreateDelegate ServerCreateDel;

UPROPERTY(BlueprintAssignable)
FServerJoinDelegate ServerJoinDel;

// This property can now be ignored if you always want the new map
UPROPERTY(BlueprintReadWrite)
FString GameMapPath;

};

shrewd ginkgo
#

I packaged my multiplayer game. the game opens, I open it on 2 different computers and I set up a server on one of them but the server shows 9.999 ms so it breaks when joining.
Ih ave pretty good connection and both pc connected same internet

dark parcel
#

you are most likely using Steam

#

and at least in the old one, the Ping is not implemented for listen server

#

9999 is just the hardcoded values

subtle kernel
#

guys, I have an Actor. And it has let's say some variable. Based on the value of this variable change something happens on the client after this variable replication. Like a sound play. Let's say it's a door. I'm struggling to understand what is the best way to determine if it's initial Actor initialization or it was later affected by player action. The problem I'm solving is how to make my doors not making sounds when I load new level 🙂

dark parcel
#

many implementation imo, just a matter of choosing which one you want to implement.

#

like you can track the current animation position.

#

and / or you can also track if the door have fully closed / open

subtle kernel
#

check if it's locked/unlocked and play relevant sound. but I can't distinguish if it was initial values replication 🙂

dark parcel
#

Probably want to wrap any info you need with a struct.

subtle kernel
#

maybe you PostInitializeProperties..

dark parcel
#

hmmm

#

I mean what's the issue right now?

#

maybe before you play / close the door, you wait for the server to tell you where exactly the door should be

#

and play anim based on the info

subtle kernel
#

server sets where the door should be, based on the configuration. it gets replicated to client and produces sound

dark parcel
#

I would just play the sound in the animation

subtle kernel
#

I don't want it to produce sound unless the action was iniated by player

dark parcel
#

or if you are using timeline, you can do that too

#

why not just make the sound play when the door is at 25% of the anim

#

kinda like anim notify

subtle kernel
#

THere's no animation

#

it's lock/unlock

dark parcel
#

ohh

subtle kernel
#

it will make it a bit more ugly :/

dark parcel
#

I still can't visualize the problem

#

if you want the sound to just play when the action is intiiated by the player then do just that

#

e.g. when the character is interacting with the chest

subtle kernel
#

well, it's not easy. there're also simulated proxies that needs to hear it

#

so I stick to replication

dark parcel
#

you mean other clients? just use multicast

#

it's a one off cosmetic thing

subtle kernel
#

I was hoping to avoid multicast. It all works perfectly now, but the only issue is when the map loads 🙂

dark parcel
#

Why do you want to avoid multicast

#

it has it's usses

#

as long they are used as they are intended

subtle kernel
#

just in this case

#

I'm not avoiding multicasts all over xD

dark parcel
#

and that's the issue with Repnotify, you are playing the sound based on the boolean value

#

it's a perfect use case of multicast?

#

if they are dropped, that's cool?

#

that way, players that just join the map doesn't need to hear the sound on every chest that is unlocked

subtle kernel
#
UPROPERTY(ReplicatedUsing=OnRep_IsActive)
bool bIsActive = true;
TOptional<bool> bIsActiveOld;

I solved it like this in one case

#

I just thought that maybe there's another way to do it

#

it's shame that OnRep won't give you previous value

subtle kernel
#

oh really? how?

#

I can use other then no parameters signature?

dark parcel
verbal ice
#

yes

subtle kernel
#

omg

verbal ice
#

void OnRep_IsActive(bool bOldValue)

#

... although for a bool you know what the old value was

#

So it's unnecessary

subtle kernel
#

I will use TOptional

#

so if it's unset, means we don't play sound 🙂

verbal ice
#

If you mean for initial replication

subtle kernel
#

yep, I only need it for initial

verbal ice
#

You don't need that

#

sec

dark parcel
#

I'm voting for multicast here though

subtle kernel
#

lol

#

I can't use TOptional with replication

verbal ice
#
if (GetWorld()->TimeSince(CreationTime) == 0.0f) 
{
  return;
}
#

in your rep notify

subtle kernel
#

wow, that looks very tricky

verbal ice
#

not really no

#

this would only be true if it's the initial replication's notify

subtle kernel
#

interesting

subtle kernel
#

why do I need to do additonal multicast when I can avoid it?

dark parcel
#

additional?

subtle kernel
#

yes

#

no multicast or one multicast

verbal ice
#

If you're replicating the value already then yeah, just use the on rep

dark parcel
#

it seems weird that you are tying the logic of a one off cosmetic action in the OnRep instead of just playing the sound with MC on interaction

subtle kernel
#

door state is not cosmetic

#

sound is cosmetic

dark parcel
#

yeah

#

and you play the sound when you are interacting with the door

#

anyway just my 2 cents.

#

seems like a perfect use case of multicast

subtle kernel
#

I will just go crazy and make GameplayAbility out of it 🙂

#

actually it's not a bad idea.. xD

dark parcel
#

my approach would be, if door / chest have animation. Play Locally on Anim Notify or Timeline

#

if no animation, then just multicast on interaction

subtle kernel
#

maybe you're right..

#
UPROPERTY(ReplicatedUsing=OnRep_IsActivatedUpdatedEvent, EditDefaultsOnly, BlueprintReadOnly,
    meta = (AllowPrivateAccess = true))
bool bIsActivated = false;

UFUNCTION(BlueprintNativeEvent)
void OnRep_IsActivatedUpdatedEvent();

I wonder why CPP version won't be called :/

#

it calls blueprint implementation, but not CPP one

verbal ice
#

The door movement is stateful, you shouldn't use RPCs for that

dark parcel
verbal ice
subtle kernel
#

oh!

dark parcel
#

Instead OnRep-> bUnlocked? If True Play Open sound else Play Close Sound
That will just play sound regardless if the chest being interacted or not. Need extra param or maybe just Multicast on Interaction if there's no animation.

If you have animation anyway, then play sound locally no rpc needed.

subtle kernel
#

for some reason now it works with TOptional<bool> being set in BeginPlay. but I think it's random

#

OnReps can arrive later then begin play for sure

shrewd ginkgo
shrewd ginkgo
#

yes

dark parcel
#

and what's the code to travel to the server?

shrewd ginkgo
dark parcel
shrewd ginkgo
#

no

#

its ok now?

#

and do I need to put a question mark at the beginning, I didn't when I create it.

dire cradle
#

You don't need to call open level after join session

#

By doing it you'd disconnect and open up a local level

#

Join session loads the server map by itself

dark parcel
#

Not sure if that matters.

#

But yea don't open level after join session.

shrewd ginkgo
thin stratus
#

OpenLevel is only needed for hosting (with the ?listen option) and potentially for disconnecting by traveling back to the MainMenu level or similar.
And of course generally to change levels in Singleplayer Games.

shrewd ginkgo
#

then why second pc can see server but cant join it

dire cradle
#

might be blocking connection

dire cradle
main bluff
#

Hi, I’ve started learning networking in UE5, and I have a question. What is EOnlineDataAdvertisementType, and how does it work? I think I understand it, but I want to be sure. Could you explain every detail? Thanks in advance! 🙂

shrewd ginkgo
fickle lichen
#

Yes, I have exactly the same problem. when a player joins the server, it just doesn't load the map. i've searched all over the internet and can't find a solution

dark parcel
#

I don't share the issue

#

I take it, you guys using space war?

#

Well if you can see the other person's session then you would have set up the appid

fickle lichen
# dark parcel I take it, you guys using space war?

no, i have my own appid. but when for some reason when i connect to a session, the game logs “Browse: steam.76561199496937360/Game/menu” it tries to load the map it is on. does this mean that the server just doesn't send the right map to the players?

dark parcel
#

No idea, I can travel just fine with friends only with join session.

#

It should travel to the map the server hosted with ?listen as the arg

subtle cliff
#

After migrating my project from 5.3 to 5.5, my multiplayer system failed to join sessions. So, I tried to use the Advanced Steam Sessions Plugin. But it is not working. I am following a tutorial on YouTube, which is quite simple and popular, but it still does not work. Does Anyone know any documentation or resources to learn more about it?
Anyone bein able to fix the issue of failing to join session on 5.5?
Its more than a week that I am dealing with these issues I would appreciate any help

fickle lichen
#

I don't know what to do or how to solve this problem

subtle cliff
subtle cliff
fickle lichen
subtle cliff
fickle lichen
#

I'm using ue5.3

subtle cliff
#

oww, on 5.3 there are not any issue you can use other methods also

fickle lichen
subtle cliff
#

by khan alpar or something. use it and it will solve your issue

#

I test it on 5.3 and it works fine

fickle lichen
subtle cliff
#

I will send it

#

[/Script/Engine.GameEngine]
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="OnlineSubsystemSteam.SteamNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")

[OnlineSubsystem]
DefaultPlatformService=Steam

[OnlineSubsystemSteam]
bEnabled=true
SteamDevAppId=480

; If using Sessions
bInitServerOnClient=true

[/Script/OnlineSubsystemSteam.SteamNetDriver]
NetConnectionClassName="OnlineSubsystemSteam.SteamNetConnection"
#

Here are my network related settings

fickle lichen
#

Hmm. Now I have another problem. now when connecting to the server in the logs writes “SteamSockets: Could not determine the binding address!” and “SteamSockets: Cannot get information on an invalid socket handle, returning null” and “TravelFailure: PendingNetGameCreateFailure, Reason for Failure: ‘Error initializing network layer.’” any ideas?

dark parcel
#

What is your steam socket setting in the ini file?

fickle lichen
# dark parcel What is your steam socket setting in the ini file?

[/Script/Engine.GameEngine]
!NetDriverDefinitions=ClearArray
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="/Script/SteamSockets.SteamSocketsNetDriver",DriverClassNameFallback="/Script/SteamSockets.SteamNetSocketsNetDriver")

[Voice]
bEnabled=true

[OnlineSubsystem]
DefaultPlatformService="Steam"
bHasVoiceEnabled=true
bAllowP2PPacketRelay=true
bUseSteamNetworking=true
bUseBuildIdOVerride=true
BuildIdOverride=1

[OnlineSubsystemSteam]
bEnabled=true
SteamDevAppId=[my steamid]
SteamAppId=[my steamid]
GameServerQueryPort=27015
bRelaunchInSteam=false
bUseSteamNetworking=true ;alterado
GameVersion=1.0.0.0
bVACEnabled=1
bAllowP2PPacketRelay=true ;alterado
P2PConnectionTimeout=180
bUseLobbiesIfAvailable = false ;alterado
bInitServerOnClient=false

[/Script/OnlineSubsystemSteam.SteamNetDriver]
NetConnectionClassName="OnlineSubsystemSteam.SteamNetConnection"

[Core.Log]
LogOnline=All
LogOnlineGame=All

#

that all i have

thin stratus
#

@fickle lichen @subtle cliff Both of you would need to do some more extensive debugging tbh.

  • If you have working versions then compare them to the ones that don't work.
    • Especially Log-wise.
  • Make sure to enable any important Log Categories with VeryVerbose logging. LogOnline and LogOnlineGame are probably not enough.
  • Make sure the projects are packaging the maps correctly, especially if you have different packaging settings for Server and Client.
  • Attach Rider/VS to your Client and breakpoint the parts in C++ where it would try to travel. See why it doesn't give you the map it should travel to.
dark parcel
#

Does declaring a variable as replicated comes with actual overhead if the value never changes?

#

I take it, the server only send data if the value changes?

#

or do they constantly get send every NetUpdate regardless if the value changes or not?

tardy fossil
#

yea pretty sure it only sends data thats changed, so there would be a tiny overhead from it checking to see if it changed

verbal ice
#

Check RepLayout.h:1069

#

has a nice long comment about how it works

#
  • When we want to replicate properties for an object, merge together any outstanding changelists
  • and then iterate over it using Layout Commands that serialize the necessary property data.
#
  • @FSendingRepState maintains a circular buffer that tracks recently sent Changelists (@FRepChangedHistory).
  • These history items track the Changelist alongside the Packet ID that the bunches were sent in.
  • Once we receive ACKs for all associated packets, the history will be removed from the buffer.
  • If NAKs are received for any of the packets, we will merge the changelist into the next set of properties we replicate.
    Also handles clients saying they haven't received some packets. Will re-send the missing changes on the next replication.
#

Or well - will send the latest version of the properties that got missed

dark parcel
#

👍 👍 👍 👍 👍

shrewd ginkgo
#

when I try to join the listen server multiplayer game from a second computer, it cannot join. I turned off firewall.

shrewd ginkgo
#

where can i access the logs of the packaged game. when i was in the editor it was connecting without any problem

thin stratus
#

Your packaged project should have a Saved/Logs folder.

#

But you need to either package non-shipping, or enable shipping logs via Source Build.

shrewd ginkgo
#

ok I'll package it the way you said and get the logs

#

ty

cloud crown
#

my ability is not being activating on gas
on client
but is activated on server
using press input id

#
                                                  class UInputComponent* InputComponent)
{
    if (!InputComponent)
    {
        UE_LOG(LogTemp, Error, TEXT("USI_AbilitySystemComponent::BindInputActions - InputComponent is NULL!"));
        return;
    }
    if (!InputData)
    {
        UE_LOG(LogTemp, Warning, TEXT("USI_AbilitySystemComponent::BindInputActions - No InputDatas provided!"));
        return;
    }
    if (ISI_InputComponentInterface* InputInterface = Cast<ISI_InputComponentInterface>(InputComponent))
    {
        UE_LOG(LogTemp, Log, TEXT("USI_AbilitySystemComponent::BindInputActions - Successfully cast InputComponent to ISI_InputComponentInterface."));
        InputInterface->BindInputAbilities(InputData, this);
    }
    else
    {
        UE_LOG(LogTemp, Error, TEXT("USI_AbilitySystemComponent::BindInputActions - InputComponent does NOT implement ISI_InputComponentInterface!"));
    }
}
grave flower
#

is there any good guids on how to make servers into your game?

ocean yoke
#
     {
         //Client-specific functionality
         if (IsLocallyControlled())
         {
             FString healthMessage = FString::Printf(TEXT("You now have %f health remaining."), CurrentHealth);
             GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, healthMessage);
 
             if (CurrentHealth <= 0)
             {
                 FString deathMessage = FString::Printf(TEXT("You have been killed."));
                 GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, deathMessage);
             }
         }
 
         //Server-specific functionality
         if (GetLocalRole() == ROLE_Authority)
         {
             FString healthMessage = FString::Printf(TEXT("%s now has %f health remaining."), *GetFName().ToString(), CurrentHealth);
             GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, healthMessage);
         }
 
         //Functions that occur on all machines.
         /*
             Any special functionality that should occur as a result of damage or death should be placed here.
         */
     }

why DebugMessages show on both client and server(listen server)
https://dev.epicgames.com/documentation/en-us/unreal-engine/multiplayer-programming-quick-start-for-unreal-engine#7testyourgame

Epic Games Developer

Create a simple multiplayer game in C++.

bright summit
ocean yoke
#

omg it works ,think you

#

By the way, are there any good Unreal C++ multiplayer game tutorials? The official tutorial is too short

inland ocean
#

Does anyone know how I can make my game work via online instead of local only

dire cradle
#

The same way you do local, but instead of a local ip you enter the public ip and port

#

Or you can also use an online subsystem like Steam

dark parcel
#

Imo

#

Rest is from pinned material on this channel and articles from Alvarez and on the net.

shrewd ginkgo
# thin stratus Any logs?

I got logs from client side pc and server side pc. I can send it private or do you want me to send it here?

hexed path
#

Hello

We are implementing Steamworks SDK into our multiplayer game. We currently need to test the Lobby Creation and Joining functionality.
Is there really no way of testing this, other than with 2 different devices, and packaging the game over and over whenever a bug happens and we fix it?

Can this be tested on 1 PC, and without packaging the game?

dark parcel
#

You can't use one PC to test Steam

tacit furnace
#

Is there anyone who knows how to create a replicated stamina system in the most efficient way?

tacit furnace
grand kestrel
#

The PredictedMovement repo in general may be worthwhile to you, version 2.0.0 is nearly finished and includes movement modifiers with varying levels (e.g. snare level 1-5, boost, slow fall, etc.)
https://github.com/Vaei/PredictedMovement/

tacit furnace
grand kestrel
#

It isn't possible to implement anything in CMC in BP, you can't make a functional stamina system with BP (its literally not possible, you will de-sync considerably even in the best case scenario)

#

If you want, I can make a note to ping you here when its released

hexed path
#

Can a client see the owner of the actors they own?

#

There is an actor, I am calling SetOwner on it from the server

#

With print string I have confirmed that it sets correctly

#

But then, when on the client, that was set as owner, I try to get owner of that actor, it is not valid, doesn't exist

#

That actor is Replicating, and always relevant.

fossil spoke
#

An Owner of an Actor can be any other Actor, there are no rules around what can/cannot be an Owner.

#

If you set the Owner of an Actor to another Actor that is not Network Relevant to a viewing Client, it will therefore be empty.

hexed path
#

The owner is a player controller

fossil spoke
#

You may need to brush up on your understanding of what the network relevancy is of the different core gameplay classes are.

#

PlayerController is only relevant to the Server and the Client that owns the PlayerController.

#

Other Clients never know about other Clients PlayerControllers.

#

Therefore, if you use the PlayerController as the Owner for the Actor, other Clients will see that Actor as having no Owner.

hexed path
fossil spoke
#

It should yes.

#

The PlayerState is a good example of this

#

The PlayerStates Owner is the PlayerController it belongs to.

#

This will be empty for Simulated Proxy PlayerStates.

hexed path
# fossil spoke It should yes.

Then I am back to banging my head on the wall wondering what am I doing wrong. May I ask for your help further, with specific examples? And if yes, should I do it here or DM?

fossil spoke
hexed path
#

Sure, thanks. Long explanation because I am giving all the relevant details.

The game is a 1v1 card game. Listen Server. So one player is listen server, the other is the client.

I have an actor called CardHand. It basically handles the logic of cards transforms.
And I have an actor called Card. Self explanatory) It is the card.

I want to make it, so that each player sees their own cards, but doesn't see the other player's cards.

Inside CardHand, I have an array called "RevealedCards". Any cards in this array, on tick have their orientation set to upwards (so player can see them). Cards not in this array, on tick are set to downwards.

CardHand - Replicated, Always Relevant
Card - Replicated, Always Relevant

Other options, such as movement replication are not ticked. Variables in those actors are Not replicated too.

On Server (I know this because I do an IsServer check before doing), I set the owner of each CardHand to their respective players. Checked with print string, the owners are being set correctly.
When a Card is added (from a server) to CardHand, I set the owner of that card, to the CardHand.

Then here's the logic I try to reveal the card only to their owning player:
When CardHand receives a card, it calls an Owning Client RPC.
The OwningClient RPC, adds the card to "RevealedCards" array. Then it checks if IsServer, it calls a Multicast RPC.
The Multicast RPC checks if Not Server, Removes the card from RevealedCards array.

Where are things going wrong here?

#

The tick of CardHand, that handles the transforms, is being performed everywhere. So it's basically just a Tick, without any authority checks.

fossil spoke
hexed path
fossil spoke
#

From what you are telling me, the Client is sending a Client RPC?

#

This would be wrong, the Client would need to send a Server RPC, to tell the Server "hey, reveal that card".

hexed path
#

Ah the multicast part?

#

CardHand Receives a card. The receiving is done on Server.
When Received, it calls an OwningClient RPC. So the server calls an OwningClient RPC.
The OwningClient RPC Reveales the card.

fossil spoke
#

Multicasts can only be called by the Server

hexed path
#

The multicast part is wrong I guess, let me try fixing it, but it doesn't explain why one of the cards is hidden for both.

fossil spoke
#

Personally how you are doing this is just wrong in general.

hexed path
#

How should I? This was the only logic I could come up with, since one of the clients is also the server (listen server).

fossil spoke
#

I would a RepNotify Bool to handle the "reveal card" part.

#

On the Card itself

#

The Card itself should be handling its own visibility

#

The CardHand is ok, it would be responsible for just saying what Cards a Player owns.

hexed path
#

Okay, so a RepNotify Bool on the card, set that bool from the server?

I am struggling with the part to show each player their own card, but hide the other player's

fossil spoke
#

When creating a Card, set its Owner to the PlayerState, there are very few reasons you would want to use a PlayerController.

#

You would also want something like a bRevealedToOpponent RepNotify Bool on the Card.

#

This would be false by default

#

In BeginPlay you would check if the Owner (which would be the PlayerState) is the same as the Local Player.

#

If thats true, then you show the card, because its the owners card.

#

The OnRep_bRevealedToOpponent would handle showing it for the opponent.

#

The Server would set bRevealedToOpponent to true when the card needs to be shown to the Opponent.

#

Replication of that variable would trigger the reveal.

#

With this setup it doesnt matter if its a Listen Server host or a Client

#

Bit of a wonky drawing but this should show you what the flow would be.

#

If the Server (Host) wants to reveal a Card, they just set bRevealToOpponent to True and it will replicate that to the Client.

#

If the Client wants to reveal a Card, they must first RPC to the Server, then the Server sets bRevealToOpponent to True and (because of how OnReps work in BP for Servers) it will execute that same reveal logic.

hexed path
fossil spoke
#

This might be a bit clearer than the one above.

#

So therefore there are no Client RPCs, no Multicasts.

#

Its stateful, which is important for other reasons.

#

I suppose you could interpret the revealing of a Card as an Event, but it could also be a Stateful transition as well.

#

In this case, I would opt for it being Stateful, since you might want to unreveal it later for whatever reason.

#

That can easily be done by just setting bRevealToOpponent to False.

#

And it just reverses the reveal.

#

Maybe your game gives the opponent the ability to see your Cards for a limited period or something.

#

🤷

#

That functionality might be useful.

grizzled stirrup
#

but a good idea to draw out stuff like this when state isn't making sense

fossil spoke
#

Yeah I was just thinking backwards in my head when drawing it so it came out weird lol

#

I find it useful to think about it in that way. Start from what you want to happen and work back from there.

#

Arrows might have been better 😛

raven bone
#

Hey people,
Not sure where to post it, here or in #cpp, but im generally very confused by the way replicated functions have to be implemented in c++, so pardon if the question is very basic.

I'm setting the basic functionality any character in the game will have - in a c++ class, and implementing the logic in blueprints.
Therefore im setting up Death().
As far as I understand, death has to be executed on the server and replicated to the clients, but if i set it to be UFUNCTION(Server) then i cannot have it as UFUNCTION(Server, BlueprintNativeEvent) - but i want to handle death in the blueprints...

The best i've come up with claude is having Death() and OnDeath(), but im confused how to continue - how do I override OnDeath()?

fossil spoke
#

Also you should not be providing the declaration for the _Implementation functions.

#

The UHT generated code already does that

raven bone
#

Am I missing a specifier? because i dont have an option to override the function and it wont fire

fossil spoke
raven bone
#

in the header? yes

fossil spoke
#

You arent using HotReload or LiveCoding are you?

#

Did you close the Editor and recompile properly?

raven bone
#

yes of course

fossil spoke
#

The code looks fine, not sure why you cant see it? How are you trying to override it in BP?

raven bone
#

well thats the issue, i dont see it in the list of functions i can override
does it have to be a function instead of an event? return a value?

fossil spoke
#

No, BlueprintNativeEvent and BlueprintImplementableEvent should appear in the lsit.

exotic wasp
#

do you see OnDeath but not Death?

#

in editor

fossil spoke
#

Actually, because there is no return value, perhaps you might have to "implement" it by right clicking in the Graph and searching for it

#

There should be 2 entries, Call OnDeath and Event OnDeath or something like that

#

Event OnDeath would be the "implementation" override

raven bone
#

calling the event counts as overriding it?

fossil spoke
#

No

raven bone
#

like this

fossil spoke
#

Yes

#

Thats correct

#

Thats not "calling" it

#

Thats the implementation

raven bone
#

i see

fossil spoke
#

Since its an Event

#

Because it has no return value

exotic wasp
#

theres a meta specifier to force it to act as a function

fossil spoke
#

If it had a return value it would be in the list and be a function instead

fossil spoke
raven bone
#

and it should fire when i call Death() since the c++ code?

fossil spoke
#

Yes

#

Note, that the C++ implementation wont be called

#

Of OnDeath

#

Since, in the BP implementation you havent called Super

#

You can do that by right clicking the node and selecting Add Call to Parent Function

raven bone
#

thats a good thing to know

fossil spoke
#

Its actually really silly that the Parent node isnt automatically spawned

#

IMO

raven bone
#

but it seems i was doing everything right, yet it wont fire facepalm

fossil spoke
#

What do you mean?

raven bone
#

besides the _Implementation, i've set the whole thing right
it should work

fossil spoke
#

I guess so? Did you run it and find out?

raven bone
#

I've tried calling Death with debug key, even with Event PointDamage which happends on the server, cant get Event On Death to fire

#

Got it!

#

in Death I should have been calling OnDeath(); and not OnDeath_Implementation();

raven bone
raven bone
#

Also, Ive changed Death to be multicast because nothing was happening on the client.
Does it makes sense to be multicast, or I should have Death to be server only, have intermediate MulticastDeath and blueprint native OnDeath?

dire cradle
#

You can keep it as multicast, and hook up a has authority node to it for stuff that only server needs to do

raven bone
#

Aight, thanks!

shrewd ginkgo
#

I am trying to search for servers in my game and join the game I set up on my 2nd computer but I can't join. this is a listen server steam game. both computers are connected to the same network. my internet connection is stable. I have left images of how I set it up and how I tried to join game and the logs of the server and client below. I would be grateful if you could help

#

by the way, it sees the server in the server list

#

just cant join when I click on servers wigdet

dark parcel
#

?listen for the args

#

as for your join logic, try to bypass the if check just to make sure you can join for now.

vague ocean
#

I have quite weird replication issue. I have a GameItem class that implements a Focus event

UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "Interaction")
    void Focus(AActor *Caller);

Im overriding this in a bp to add a overlay material onto the game item's mesh. I'm sending a raycast from my player character into the item and when it hits, im calling the focus event on it. im using a dedicated server with 2 clients. when Client 2 hits the cube it gets the overlay material applied... but on CLIENT 1 for some reason?

dark parcel
#

not enough info tbh.

#

tell more about how the instruction is communicated.

vague ocean
#

If thats what you mean

#

Im starting to think there's something up with the event tick on that particular blueprint

dark parcel
#

Any reason why is this networked? Highlighting item is normally is done for the local machine only.

vague ocean
dark parcel
#

unless it's the intention to highlight an item when some other player looking at it

vague ocean
#

But I've tried client RPCs, everything

#

its always showing up on the server

dark parcel
#

why is it even networked at all

#

Just If Locally Controlled -> Trace -> Set Material

vague ocean
#

Focusing itself needs to be networked, but the highlight I want client side

dark parcel
#

On Tick -> If (FocusActor)-> Set Material