#multiplayer

1 messages · Page 109 of 1

queen escarp
#

if i call this chaning a bool on server

#

and the bool is "replicated"

#

it should send on all other clients aswell right

#

i wouldent need to multicast

#

thats the whole point of replicating a variable right ?

thin stratus
#

Yes

queen escarp
#

ok and RepNotify dose what ?

#

i know i can google but better to be explained from the pros

quasi tide
#

Luckily these "pros" have written articles about this very thing. Even better - it is in the pinned resources.

queen escarp
#

lucky me X=)

sinful tree
#

So when you change the value from false to true on the server, the OnRep function will fire on clients, then you can do what you want with the new value of the variable, like update UI or change whatever you need to based on that value.

queen escarp
#

ohhh

#

ok cool ty

shrewd ginkgo
#

can I set player controller class in blueprint?

whole pine
#

what method could i use for this

ivory dagger
#

here, during beginplay event on the controller

sinful tree
#

Are you receiving any errors in your log when you have the looping bit hooked up?

ivory dagger
sinful tree
ivory dagger
#

i'll try to recreate the error, wait

sinful tree
ivory dagger
#

its working now and doesnt give any error for some reason

#

i was working on that code yesterday and it was giving error then

sinful tree
#

Glad it's working then 🙂

nocturne quail
#

it was needed custom replication to handle it in my case

quartz iris
#

How can I fix this code for starting a 1 vs 1 match

#

This is the code within the gamemode

#

This is the code within the gamestatebase

#

It seems that only the server has the widget displayed

#

Is it because the gamemode doesn't have access to the player array? If so how can I fix this

sinful tree
# quartz iris

It's probably not showing on the client as you're effectively calling the RPC almost immediately without giving the chance for the client to actually receive their pawn so they can receive the RPC on it.

Ideally you probably wouldn't use an RPC for this, but use a replicated boolean with OnRep in the GameState. The OnRep function could call an event dispatcher which your PlayerCharacter could bind to or read from when the PlayerCharacter is starting up on the client (begin play > is locally controlled (true) > read gamestate if true show UI else bind to event dispatcher in game state. Event Dispatcher Called > Read Value > if true, show UI) to know when the value changes and then display the UI as needed.

storm valve
#

guys how can ı do multiplayer doors my doors isnt working

hoary spear
#

Im sure theres tutorials avaliable for that

#

Youd prob want to repnotify a bool in the replicated door ,

#

Modifying the state if the door from server side, through some rpc in player character

low dew
#

hi, i have a question, i suppose to be post here. i have some difficulties to replicate movements in multiplayer : i use Blendspace 2D ( forward, strafe, backward, run..), i have check replication on inputs variables ( x,y )[BP player] on the server it's ok - the client see it, but the client move and server don't see animation, i have tried to enable root motion/add movement, if some one have at least screenshot of sample ? i think i miss something

#

(i m aware of server/client play anims) it's for blendspace 2d

dark parcel
low dew
#

blueprint player, animation bp ( idle/move ) and variables input LR and FB replicated

dark parcel
#

Replication works one way, from server to Client

low dew
#

yes

dark parcel
#

I Don't really do multiplayer so take it with a grain of salt and hopefully someone else is online
So if your client move and change the variable, server will not know anything about it because replciation works one way

#

you probably need to send RPC to let the server know that InputLR is updated

low dew
#

and multicast the input, sound brutal ^^

dark parcel
#

No multicast needed at all

#

You simply set the Variable in your client, then at the same time send a server RPC on the server

#

If the variable marked as replicated, it will automatically replicate the value to all clients

#

Also make sure to set it as unreliable because something like this don't have to be reliable

low dew
#

aw, i see the point

#

i will try it, but if any other solution i will take it guys

dark parcel
#

again, I could be wrong as I don't make MP game hopefully someone can show their workflow

low dew
#

yeah yeah but let's dig this way

#

and yes if someone can show their workflow

#

thanks anyway, i look

dark parcel
#

If that works out for you and you want to see smoother changes from other clients, consider interpolating the old value and new value. Eg Interpolate between LastBlendSpeed with CurrentBlendSpeed

#

also might want to change the replication condition as the owning client doesn't really need to get the value from the server

low dew
#

Bad arrangements, but it work

#

Run on server event

#

some other things to fix, but thanks @dark parcel , i got a way to explore

queen escarp
#

hey guys

#

Game Instance is Consistent Between "map loads" etc even on multiplayer

dark parcel
#

@low dew Doesn't look like it will work all the time to me but I can't really judge X_X
imo you should be calling server RPC after you set the variable locally on Client
For server you can just set the variable, no additional work required.

So maybe have a switch has authority right after triggered -> Client will Set the Float and Call Server Rpc
Server -> Just set the float value

queen escarp
#

so saving stuff "locally" would be best place there right ?

dark parcel
#

You get GameInstance when your game runs and it will be gone when you closed your game

#

don't see how map load or multiplayer come into the equation, GameInstance is just a presistence object

queen escarp
#

oh yeah i mean, when u change game modes, player controllers etc etc

dark parcel
#

It's totally unrelated to game Instance tho

#

there is only one game instance

queen escarp
#

oh right, for each client right ?

dark parcel
#

it's there when you run the game, it's gone when you close the game.

#

Yup for each client

#

and it matters not with what your game mode or player controller is

queen escarp
#

aye so putting save stuff logic would be best place there right ?

#

ah ok

dark parcel
#

It have it's usess, depending on what you want to do, do it where it make sense the most

#

if you just need to have a value that you don't need to save but u want to keep it between levels, there is no need to use savegameobject

#

gameinstance can do the job

queen escarp
#

yeah thats what im trying to think of. basicly im going to have a "profile save/load"

#

aye that was my first question just badly formulated lol

#

ok so keeping for instance "exp" whatever wont reload on each level load

#

so keeping info like that is good

#

where would i best save "account stats" then ?

#

game mode `?

#

controller ?

#

or W/e

potent token
#

hi, does bAlwaysRelevant only effect the network update of the actor, or it will get rendered in the client too?

tight jacinth
#

Is any Firebase(sort of free online db) analogue for Online Steam Subsystem or I will have to connect to Firebase via http reguests?

tall current
#

im new and wanna know how does multiplayer works of ue ty in advance

fathom aspen
fathom aspen
fathom aspen
tall current
fathom aspen
#

Literally opening the editor and choosing to "play as client"

tall current
fathom aspen
#

Your terminology proves that you still lack experience, so you need to learn the basics first

#

Go to pins, start reading

tall current
shrewd ginkgo
#

I make a password system for lobby but its not work

#

I cant get it whats the problem. How can I solve it

queen escarp
#

ok so just by adding this one in the game mode

#

then my character dosent spawn at all ?

fathom aspen
#

You need to call parent implementation

queen escarp
#

meaning ?

fathom aspen
#

Right click on the node

#

There you go

queen escarp
#

call to parent function ?

fathom aspen
#

Yus

queen escarp
#

ok i dont get it im just trying to add players to an array and id better use on post login i suppose what would be the reson for using that one ?

#

and how is this not working :&/ ?

thin stratus
#

You are calling that on Server-side

queen escarp
#

oh

#

that makes sense tho

#

all "game modes" are all on server side only right ?

quasi tide
#

Yes

queen escarp
#

but a server can "multicast" right i tried that also

#

that should have worked from that side right ??

#

those are the only one that can multicast*

#

but i did it via the gamemode with 0 affect

sinful tree
# queen escarp

When you place that node in the blueprint, you're overriding a function within the GameMode that normally spawns and possesses a player for you.
If you right click on the event, you should have the option to "Parent Call" which then you can connect either before or after your own code and this will ensure the original code will still be executed. Make sure you hook up the "New Player" pins between them so the original function gets the data it needs.

sinful tree
queen escarp
#

ahaaa ok

sinful tree
#

What you're trying to do there can be accomplished on Begin Play of the Player Controller.

queen escarp
#

yeah im just messing about trying to learn

#

so player controlelr is both server side/ client same as the character right

sinful tree
#

Yep

#

But only for the client that owns that player controller. It's not accessible to other clients.

queen escarp
#

hm ok,

#

and the game instance

#

is only 1 locally per client ?

#

nothing on server side on that one

sinful tree
# queen escarp and the game instance

One exists on each instance of the game running, including on the server's instance, but it is not a replicated actor, so when you access it, you're accessing the local copy of wherever you're calling it from. So if you're running on the server, you're getting the server's GI. If you're running on a client you're getting that client's GI.

#

I'm fairly certain it doesn't, but having a server call a server RPC is something to be cautious of as it could potentially be a means of cheating by a client bypassing an earlier server RPC.

queen escarp
#

Ah ok gotcha

#

All this makes more and more sense but its the beginnning thats hard when u can start fiddeling with it youll learn much faster

#

Like the core stuff like getting all the players displaying all their names etc

#

Once i understand that i will progress alot

quick saffron
#

is WithValidation actually required in c++? I heard some people say it might not be

solar stirrup
#

Defo not in UE5, maybe not around 4.20+

shrewd ginkgo
#

can anybody help me for this password system for lobby. I can get whats the problem.

quick saffron
dark edge
whole pine
#

why does one work and the other doesnt?

cerulean plover
#

Can someone explain how i can share a project

#

nvm

vivid seal
#

Wait they’re separate variables…?

whole pine
#

yea

#

@vivid seal

vivid seal
#

I’m confused why you have two separate variables for this, and also why you set the bool value but don’t check it in the OnRep.

#

Currently setting one of those variables to true OR false will do the same thing

whole pine
vivid seal
#

It should just be one server RPC called “Set typing bubble” and you can pass either true or false. Then you just set the variable on the server with notify, and in the OnRep, you plug that variable in to the new visibility checkbox. At least I think that’s what you’re trying to do?

whole pine
#

ok ill try

vivid seal
#

Np

blissful island
#

hi, im trying to make a simple change of material when going inside of box collision with rpc, now i have made 2 custom events one that is multicast and one on server, but when i run it, it doesnt want to work for the client side but works on the server side

#

i have checked the "replicates" and "net load on client" on the actor, but doesnt seem to work for me

sinful tree
# blissful island hi, im trying to make a simple change of material when going inside of box colli...

You cannot run RPCs to the server in an actor that is not owned by the client.
The overlap itself should be detected by the server, so you can use a "Has Authority" (Authority) > to gate the execution based on the server detecting it and then you can call your multicast. You can't use GetPlayerCharacter 0 like you are, so instead, try using a cast to Character to ensure that it's a character that is overlapping.

blissful island
blissful island
#

nvm got it figured out, ty 🙂

amber stone
#

Would anyone happen to know why my log isnt showing up in my dedicated servers log? This pic is of my BP_DefaultGameMode. I also am launching the dedicated server with the -log and -server flags and I have the blueprint set as my default game mode in the project settings.

sinful tree
#

Did you set the world settings of the level you're using to use your custom GameMode?

amber stone
#

GameModeBase

#

And no to the world settings.

#

Will do that

#

and I havent even put a GameState class in the game as of yet.

amber stone
#

Could you maybe tell me why its not the color I chose? or is the color option just for the on screen text?

#

I see the log tho

#

its just not green

#

like I have in my BP

sinful tree
#

Just make sure that if you are using GameModeBase that you're using GameStateBase or a child of it. If you don't use the corresponding one it can cause weirdness to happen preventing some things happening correctly.

The log color itself isn't based on the color selected, that's only for the color on the screen.

fathom fossil
#

Is there any way to override replication behaviour for member properties in a child class?

sinful tree
fathom fossil
whole pine
#

how would i go about connecting a certain variable to a certain name

#

so if i click a specific name it brings up a specific value of the variable

dark edge
whole pine
#

it is

dark edge
#

So either use a map or a custom structure or 2 parallel arrays

whole pine
dark edge
#

Yes you do. Maps don't replicate tho if that's a thing you need.

whole pine
#

im trying to set the worn items under the logged in users name(string) so i cna call the string from other players to see the worn items value

whole pine
dark edge
marble fox
#

How can i replicate sound and FX in multicast without the sound playing twice ?

#

i guess instead of calling the server if we dont have auth and the server calling the client funtion i just call the server func and put it in there

graceful viper
#

If I pass an array through an RPC that's replicated will it still share the same reference? What about a a TObjectPtr?

thin stratus
thin stratus
#

or assets fwiw

graceful viper
#

Good to know, and what about if I spawn a replicated actor on the server, if I pass that reference or would also share the same reference?

thin stratus
#

Replicated Actors, if by then spawned and replicated, will have a valid reference in the array usually

#

+- relevancy

graceful viper
#

Are there any other big functions other than spawn actor and destroy that are automatically replicated? Any sort of info on this? How about built in functions that call to the server? Think there were some of those that exist

chrome bay
#

They aren't really replicated functions. Replicated actors being spawned/destroyed is just replicated.

graceful viper
#

Yeah i shouldn't have asked the first question

uncut frost
#

Hey quick question:
I'm trying to have a character (inherited from ACharacter) to move and jump on a moving platform (following a spline). I'm using SmoothSync (plugin) for the moving platform which seems to do a great job replicating the movement.
However, I'm having a jitter issue only when I jump and also the character isn't always adding the platform's velocity.
My original idea was to attach the character to the platform, but the unreal's default movement character component wont react properly of course with the jump.
(Note that I tried playing with impart velocties and ground friction)
Any clues on how to approach this simple design feature (that we could see on sea of thieves for instance: character locomation on a boat) would be more than welcome 🙂

chrome bay
#

You shouldn't need to attach anything. So long as the component is a movement base, the character rebases it's movement to be local to that primitive.

opal shore
#

what can i do for fixing ClientEncryptionKey must contain 64 hex characters

chrome bay
#

There will always be a correction since the character is forward-predicted by the client and smooth-sync/physics is not.

uncut frost
#

Thanks for answering 🙂
My issue only comes the jump though.

#

Not attaching was my first go to way as it should be handled by unreal of course

chrome bay
#

Well, the issue is that the platform is behind the server on your local client. When you jump, you're not longer "based" on it. The Server will snap you to where it thinks you are relative to the platform initially

#

TL;DR as soon as you leave the platform, your pawns movement is no longer relative to what it's standing on, and since the platform is ahead on the Server, it will "correct" the client it thinks is misspredicting. A custom jump implementation which handles jumping off a moving platform and increasing the error tolerance is probably the only way to achieve it - but also note that other clients will likely see your player acting strange in that scenario.

uncut frost
#

Hence my intention to attach everybody on the platform (which basically in my context is a ship)

#

so at least people nearby will experience movements in the same local coordinate system

chrome bay
#

I'm fairly sure character movement doesn't handle the character being attached to things

uncut frost
#

yes

#

indeed

#

I was hopping for somebody to tell me that I'm wrong thinking that 😄

chrome bay
#

Alternatively, customise the component so that the movement base is also what you are jumping on/over

#

For a sea-of-thieves like approach that would probably be viable. Just make all movement relative to the ship within a specific area

uncut frost
#

Yeah :/

#

Rewriting the movement component for a character basically is what I though I was going to avoid 😄

hasty stag
#

I have looked on the issue tracker for something similar but couldn't find it, so I think I'm doing something wrong here.
When trying the following I get some odd behavior:

  • Attach the character of a remote player to a rotating actor
  • Detach the same character from the rotating actor

Every player, except the owning client of the character, sees the character standing on the floor normally and without the rotation of the rotating actor.
The owning client sees their own character with the rotation which it had just before being detached. When jumping on top of another actor, such as the blue boxes in the third-person project, the rotation resets for the owning client and is the same as for everyone else.
Engine version is 5.2.1

cedar lagoon
#

Guys does anyone knows why the Enhanced Input System is null when I try to access it inside the PlayerController of a client, works for the server (the host player)

fathom aspen
#

Because you are doing it in a server only function, that lacks a local client execution path

#

That's usually OnPossessed

#

You will want to instead use ReceiveControllerChanged and check if IsLocallyControlled

woven bramble
#

All I want is to send LineTrace when I press the F key and set a Slot of the Struct. When I press the G key, I want set "Empty" the slot of Struct. This is the process of picking up and dropping items. It works perfectly on the server side, but the client does not work, why?

I send LineTrace via RunOnServer and start the process in the photo. ItemStruct variable does not change for client. When I do RunOnServer > Multicast > LineTrace, it works. The struct changes the way I want. But when I press the G key and make "Empty" a slot, it doesn't change.

sinful tree
woven bramble
#

I think the problem comes from here. This is the action of doing "empty" when pressing the G key. RPC didn't work.

sinful tree
#

Additionally, you shouldn't be RPCing that much information to request to drop the item. Just requesting the slot to empty should be sufficient and the server can figure out the rest without the client telling it.

woven bramble
#

But we didn't do RPC in the first photo. Actually we just made a RunOnServer and sent a LineTrace. We didn't RPC in SetMember operation?

#

So the first photo is correct, I should RPC (setmember side) to the second photo, right?

sinful tree
#

If you're trying to replicate anything, then it needs to be handled on the server so the server manages replicated actors and sets values that should be correct.
Client Input > Server RPC > Server Does things to Replicated Variables/Actors

So pick up should be:
Client Presses Key > Server RPC > Server checks for empty slots, sets member in struct > Destroy Actor

Drop should be:
Client Presses Key > Server RPC > Server determines what the client is currently holding and if something removes item from structure > determines object class > drops the item near the player (spawning an actor I imagine)

woven bramble
#

If it's correct, I will prepare the Drop system. (I hope it's correct)

sinful tree
woven bramble
sinful tree
#

It's not that it is wrong. It is that you're allowing a client to tell the server data that the server can determine itself. This can lead to people cheating as someone with a little knowledge could call this RPC at any time with any values. If you don't care about that, then it's fine.

woven bramble
#

Here is the 2nd photo.
Drop system, but it didn't work :/

#

RunOn> Multicast or RunOwningClient did not work either

sinful tree
#

Doing this directly doesn't do anything as "Set members in..." nodes uses a "Reference" to the structure - you want to input the actual variable into the "Struct Ref" that needs to change.

woven bramble
sinful tree
#

Input > Run On Server > Server Does the Logic & Sets Variables

amber stone
#

I was hoping someone here could clear up some confusion for me. Does the "GameInstance" run on both the client and server?

#

From my understanding

#

it runs on both

#

but they dont replicate

#

so the server has its own instance

#

and the client has one

sinful tree
amber stone
#

Game mode only runs on the server

#

and Game state runs on the server and clients

sinful tree
#

And yes, not replicated, so when you access it, you're accessing the one that's on the instance that you're trying to access it from.

woven bramble
amber stone
#

game state can be replicated tho

#

Im just making sure my understanding of the 3 different options is correct.

#

and if so, could anyone explain why this snippet of code from my Game instances Init function is only printing the Dedicated server log.

sinful tree
amber stone
amber stone
#

because the IsDedicatedServerInstance() is throwing true on both my client and my dedicated server.

#

My initial assumption would be to use the GetLocalRole() function

#

but thats only for actors

#

and from what I understand the instance isnt actually an actor at all

sinful tree
#

Before a "client" connects to a game, then it's effectively running standalone, which for all intents and purposes sort of acts like a dedicated server, it's just not allowing connections. I'm not sure how deep IsDedicatedServerInstance() goes for actually determining that. You're probably better off checking the net mode.
World->GetNetMode() == NM_DedicatedServer

amber stone
#

ahhhhh, now there is a method I didnt know existed yet.

woven bramble
# sinful tree Best I can do...

Interesting, but it didn't work. The server can drop the item, but the client does not react as if the G key is not working officially.

opal shore
#

any possible fixes for this?

woven bramble
#

@sinful tree The problem solved

#

I also ran the Enum itself on Server, problem solved.

#

Thank you so much!

blissful island
#

hi, i have created an c++ first person project in unreal 5 and currently having a bit of hard time getting the projectile to show through c++, the problem that i cant figure out is that the shooting/where the projectile is being spawned at is in a skeletalmeshcomponent which means i cant use "hasAuthority" and i want to simply get projectile to show on client ( its showing in server ) currently i have only unreal engine c++ code, i dont know what code i cant use to replicate projectile

amber stone
sinful tree
shrewd ginkgo
#

how can I give different mesh for every person who enter map. Everyone must have diffrent mesh

amber stone
# sinful tree Don't think you can. Closest you can do is something like this...

Maybe im doing this wrong then. I'm trying to get a very simple idea going, correct me if its the wrong mindset. I'm trying to get a client and a dedicated server to see each other. Each has a Game<Server|Client>.Target.cs file. Each one compiles and cooks fine.

I have a game instance c++ class with a derived blueprint class. Along with a GameMode c++ class and derived blueprint. In my Game instance c++ I have an Init function that inits some delegate functions, and I have two blueprint callable functions. The first blueprint callable, starts the dedicated server session and I call it from the GameMode blueprint, the second is a JoinServer function that is called from a UI widget via a button push. For some reason Online session search isnt working, BUT my client can connect to my servers running level if I open the console and open ip:port

#

I can give you any code/blueprint pics needed

fossil spoke
#

@amber stone Check the Logs

#

The Logs should tell you why it failed the search.

#

Also, you will need to double and triple check that you have the right settings for the Session.

#

Its presence needs to be setup correctly for it to be searchable.

amber stone
#

its not failing TO search, its just not finding what its supposed to

#

at least thats what I see so far

fossil spoke
#

Then its likely the Session doesnt have the right settings

amber stone
#

hmmm

fossil spoke
#

What settings are you using?

#

When you call CreateSession?

amber stone
fossil spoke
#

Remove all of the settings except for bIsDedicated, bShouldAdvertise and bUsesPresence

#

Oh, and NumPublicConnections

#

Start with as little changed settings as you can until its searchable

#

@amber stone Are you 100% sure the Session is being created?

amber stone
#

I'm not sure if I can actually answer that correclty. I can, yes, join it from the client window, but only from the console with the open ip:port command

#

and it also works over the net

#

so I can punch my WAN address in with the port as well

#

but Im not sure if that is actually creating a "session" that can be searched or not

fossil spoke
#

The Logs should tell you

amber stone
#

but I do know that the IP connection is working

fossil spoke
#

Always check the logs man

#

The log is there to literally tell you whats happening

fossil spoke
#

Not that its searchable via session handling

amber stone
#

gotcha, thats what I assumed

#

The only piece of information I got as of this moment that server is starting is a 1 return code from the CreateSession function on my SessionInterface

#

[2023.08.16-22.43.33:402][ 0]LogTemp: Warning: CREATE_SERVER_HIT
[2023.08.16-22.43.33:403][ 0]LogTemp: Warning: Succesfully started server session: 1

fossil spoke
#

The Session interface should give you more information

amber stone
#

thats coming from my on session complete delegate

fossil spoke
#
[Core.Log]
LogOnline=Verbose
LogOnlineSession=Verbose
#

Add this to your DefaultEngine.ini

#

These will help print more information to the Log

amber stone
#

Not sure what Im doing incorrect in the process? Does the editor boot a dedicated even though I set the Netmode in editor to client?

#

i thought that was standalone?

fossil spoke
#

Honestly I would separate this from the GameInstance

#

Put it in a GameInstance Subsystem instead

amber stone
#

please do, direct me with a better approach

#

this is my first naive attempt through this

shrewd ginkgo
#

how can I give different mesh on same pawn for every player who enter map. Everyone must have diffrent mesh

cedar lagoon
#

Hi, what would be the best way to have a Turret actor spawned on the server and replicated to be controlled by the host or any client.
Especially I'm having trouble finding a correct way to replicate the turret rotation, as I use the Event Tick on the server side of the Turret to update rotation smoothly with RInterpTo, and for now multicasting once updated on local actor, but I assume this is not correct using MC in the tick event.
Any idea would be appreciated thanks

fossil spoke
#

@cedar lagoon Make it a Pawn?

#

It can then be easily possessed by anyone.

#

You can even manage rotation easily as well since it would just be the Control Rotation.

#

Which is already replicated.

amber stone
# fossil spoke Put it in a GameInstance Subsystem instead

So I finally have it working, but im not 100% sure which of these two thing I changed caused it.
I added this line to my CreateServer function
OnlineSettings.Set(SETTING_MAPNAME, FString("TopDownTestingMap"), EOnlineDataAdvertisementType::ViaOnlineService);
and I also found that I forgot to add the 'override' keyword to my virtual void Init() function in my GameInstance.

#

One of those two things made my sessionquery finally work

#

I can actively turn my dedicated on and off, and test the query and see it finding it and not finding it accordingly.

fossil spoke
#

Ah yes

#

I forgot about that

#

You must set at least 1 setting value. Otherwise it makes the Session unsearchable

#
    HostedSessionSettings = MakeShared<FOnlineSessionSettings>();
    HostedSessionSettings->NumPublicConnections = Options.Slots;
    HostedSessionSettings->bShouldAdvertise = true; // Discoverable by FindSession.
    HostedSessionSettings->bUsesPresence = false; // Set to not discoverable by Presence (EOS Overlay, Steam Overlay etc) as we already use this for Parties.

    // You *must* set at least one setting value, because you can not run FindSessions without any filters.
    HostedSessionSettings->Settings.Add(DEFAULT_SESSION_SETTING_KEY, FOnlineSessionSetting(DEFAULT_SESSION_SETTING_VALUE, EOnlineDataAdvertisementType::ViaOnlineService));
#

I missed my own comment in our code

#

lol

#

See second to last line.

amber stone
#

Shit yeah. im glad I got this finally figured out. This has been a nightmare.

#

2 days spent scouring docs for that answer

#

lul

fossil spoke
#

Everyone goes through this journey.

#

Once you get it, you have it.

amber stone
#

I love this discord. This place has sped up my rubber ducking 10 fold.

brisk zinc
#

is there a list of data types that are supported for replication?

fossil spoke
brisk zinc
#

TMap and TArray

fossil spoke
#

TArray is, TMap is not.

brisk zinc
#

and also wondering if the types of the TArray matters

fossil spoke
#

TSet is also not able to be replicated

brisk zinc
#

what about structs?

fossil spoke
#

UStructs will be replicated based on their members types

#

If you have a UStruct that contains a TMap, the TMap inside the struct wont be replicated

#

Because it doesnt support replication

brisk zinc
#

I see. thank you so much for the clear explanation

#

Will TArrays be replicated regardless of type?

brisk zinc
fossil spoke
#

If a type doesnt support replication (TMap) there is no way to magically make it replicate, regardless of what containers you want to place it in.

brisk zinc
#

Okay, thank you

fossil spoke
#

There are ways to "fake" a TMap for replication

#

Such as

#

A TArray that contains a UStruct with 2 members, one that identifies the element and the other which contains the data.

#

You may also be interested in reading into Fast Array Serialization as well.

brisk zinc
#

thank you for the suggestion

#

where can I find information on Fast Array Serialization? I've tried googling that term, but I'm not sure what I should be looking for

amber stone
#

Is there a way to get ip information from FOnlineSessionSearchResult?

#

Im just curious about how the SessionInterface->JoinSession() works

#

How does it resolve

solar stirrup
#

You need to join the session to get a connection string from it afaik

fossil spoke
#

It should lead you to the source code for FAS

#

The .h file also contains helpful comments on its usage

#

@amber stone It depends on what Platform you are using and what Settings it has.

#

If you are using Steam Sockets for example, it will return a Steam Address

#

Not an IP.

#

The OnlineSession Interface provides a function for retreiving the connect info

#

IOnlineSession::GetResolvedConnectString

#

You would use this after you call FindSession

ivory dagger
#

i want to add an actor in my game that always faces the local player. how can i get a reference to local player or controller for this? can someone help me on this pls?

ivory dagger
fossil spoke
# ivory dagger bp

Generally speaking calling GetPlayerController should always return the local player

#

Unless you are running on a Dedicated Server

#

Since that wouldnt have a local player

ivory dagger
fossil spoke
#

How do you mean?

#

Where are you using it?

#

How are you accessing that function?

#

GetPlayerController is a static function.

ivory dagger
#

im still a beginner in networking so idk if im doing smth wrong

fossil spoke
#

Well you didnt pay attention to detail when i said GetPlayerController, which is different to GetController

#

GetController is retreiving the Controller that is possessing that Character.

#

Oh I see

#

You are using GetPlayerCharacter

#

Not GetPlayerController

#

Which is why it stops working when the Pawn dies.

ivory dagger
#

mb

#

fixed it, i'll try running it again now

fossil spoke
#

@ivory dagger Try this.

amber stone
ivory dagger
fossil spoke
ivory dagger
#

its working ok on clients now but doesnt work at all on the listen server

fossil spoke
#

Its likely that it doesnt. Since you need an underlying platform (like Steam or EOS) to deal with the session handling

fossil spoke
ivory dagger
#

could it be possible that the controller at index 0 is some client's controller?

fossil spoke
#

You need to replace the GetController bit at the start

#

On the Host, the Controllers for the other Players will be valid.

#

Use the method I have in the picture I posted above.

#

IsLocallyControlled

ivory dagger
#

yeah i see now that youve pointed it out

#

man learning to program is hard

fossil spoke
#

It takes time.

ivory dagger
#

everything works now. thanks so much man

fossil spoke
#

👍

cedar lagoon
# fossil spoke <@149935009581629440> Make it a Pawn?

Well it is a Pawn, but nothing gets replicated by default on my side, I need to enable something ?
Also the turret is composed of different static mesh, and the one I want to control is the head of the turret which has barrels attached. If I were to use the Add Controller Yaw/Pitch Input, how do I make it so that It actually affect the Head mesh ? That's what I don't understand

astral silo
#

Hi Everyone,
Does anyone have any advice as to how to return to lobby level when there are two players in a room? I’d like any player to have the ability to return to the lobby map at will, leaving the other player in the previous room. Open level works without issues when there is only one player in a room, but I’m having difficulties when there are two or more players. The same goes for trying to host a different room while already in one. Any help would be appreciated. Open level node doesn't execute for any of the players. I'm using Photon.

queen escarp
#

do sounds need to be Rpcs so other player hear is ?

#

even if its play sound at location ?

chrome bay
#

Sounds are not replicated if that's what you're asking, you don't usually write netcode to do that specifically, clients just play sounds when something else happens locally.

#

What's the use-case?

true spade
#

Hi, I have a question about one progression in multiplayer games, I'd like to implement large-scale progression system inside multiplayer game. For now I'm researching how to implement it, and tbh not sure rn. Is there any way or what's the best way of implementing large-scale progression system? Use-case or steps will be great and thanks in advance

twilit radish
true spade
queen escarp
#

@chrome bayi mean im my case doing a fps when a player fires then a person close wants to hear it

chrome bay
shrewd ginkgo
#

how can I give different mesh on same pawn for every player who enter map. Everyone must have diffrent mesh

twilit radish
#

If it's only for visual purposes and not for collision then you should be able to set the mesh in for example BeginPlay (or similar) to whatever you want. Unreal shouldn't override the mesh randomly.

dark edge
#

Or.do you want 1 actor to look different for every client?

dark edge
true spade
rocky kestrel
#

I have problem with melee attacks. I have basic input event and then it plays "Animation montage" to server and multicast. It works. -> In animation montage I have notify function to call "Melee Attack" in player.

#

This "Apply damage" is executed

#

But no object receive it

#

This not executed

queen escarp
#

@chrome bay only using bp´s :/ sry

nocturne quail
#

what component works with a text file that I should use to handle user accounts? mean only user accounts in the text file will be allowed to join the server

elder lynx
#

I am facing one issue on disconnection and reconnection. Basically I am disconnecting in jump state while I am in air and when I reconnects my player is going back to the same location where it was before disconnection but for simulated proxies it has reached down. So how to fix this issue. And I saw one variable also calle bRunPhysicsWithNoController which will allow to simulate physics on character without player controller but still it is not working.

rain condor
#

How can i align first person gun with third person gun? If u see on pictures, one is aiming on head and third person is aiming on chest

nocturne quail
rain condor
#

That's aim offset bp

#

I don't have camer for 3rd person

nocturne quail
rain condor
#

It's attached

nocturne quail
rain condor
#

Yep

nocturne quail
rain condor
nocturne quail
#

take a screenshot

rain condor
rain condor
nocturne quail
#

seems like everything is correctly working

rain condor
#

Yep i know

#

Haha

#

I used this function to align 1st person gun to camera

#

1st pic is align, second it's without function

magic furnace
#

Here I am 3 years later, and can't ping my server on playfab, I am sorry to ping you over this, just found it funny. All the code you provided unfortunately didn't get me there yet :/. I wonder if maybe I am pinging the wrong port, maybe I should be pinging the steam query port instead of the game port aka 7777 which I set on playfab? You seem to be using steam_udp which I don't know which one that is.

queen escarp
#

@chrome bay why wouldent i rpc. Sound like that btw :/?

unique ferry
#

alternative to 'was actor recently rendered' node for mp?

magic furnace
#

my bad

#

now the only problem is the server browser not finding it

#

otherwise all working

blissful island
#

hi, anyone know if there is a way to replicate or make rpc call in skeletalmeshcomponent in c++?

thin stratus
blissful island
#

you mean i should make variable of the skeletalmeshcompnent in an actor script, then make rpc call in there?

elder lynx
#

I am facing one issue on disconnection and reconnection. Basically I am disconnecting in jump state while I am in air and when I reconnects my player is going back to the same location where it was before disconnection but for simulated proxies it has reached down. So how to fix this issue. And I saw one variable also calle bRunPhysicsWithNoController which will allow to simulate physics on character without player controller but still it is not working.

thin stratus
#

The question itself is also very strange, cause usually people don't need to do that

thin stratus
#

There were a few people that suggested a different way to ping the servers etc.

#

But I haven't worked with this in ages, so probably can't help much

blissful island
#

ye i know, im trying to replicate or make rpc call for projectile on the default projectile, and unreal have put the fire code in a skeletalmeshcomponent so its pretty difficult to replicate or rpc call the fire function

thin stratus
#

and unreal have put the fire code in a skeletalmeshcomponent
What fire code? There is no fire code in a SkeletalMeshComponent

blissful island
#

firstpersonshooter project, when i create one, the shooting function is inside of a skeletalmeshcomponent

limber gyro
thin stratus
#

SkeletalMeshComponents only provide SkeletalMesh rendering. There is no way there is actual shooting code in there.

blissful island
#

unfort there is atleast in c++ xd, for more specific it in unreal 5

limber gyro
blissful island
#

i do know unreal 4 does not if im correct

blissful island
#

yes

thin stratus
#

Please share the code that is apparently inside a SkeletalMeshComponent and that shoots

limber gyro
thin stratus
#

I don't have the templates downloaded so I can't double check this

blissful island
thin stratus
#

What in the absolute f*ck

blissful island
#

ikr xd

thin stratus
#

Where is that code from? Is that literally generated from the Engine ?

blissful island
#

yes

thin stratus
#

haha

blissful island
#

but i think its for the action input

thin stratus
#

Well, sorry for doubting but that's just funny

blissful island
#

np xd

thin stratus
#

You should be able to perform RPCs and replicate Variables though

#

The Component just has to be marked as replicated

#

And it has to be part of a replicated actor that is owned by the client (for Client/ServerRPCs)

blissful island
#

variables is fine, but its just that when i have to use "hasauthority" or "role" thats where the problem comes

thin stratus
#

Why exactly

#

Also it still completely escapes me why Epic puts a WEAPON COMPONENT as a SkeltalMeshComp child.

#

That's kinda against the idea of reusable components

#

Like, just make it a Scene or ActorComponent and put it alongside the SkeletalMesh, or just code it into the damn weapon ;_;

#

rant off

blissful island
#

im trying to make the projectile show when client shoots, it shows when server shoots but not client, so i have to replicate or rpc call the spawn of the projectile which is inside of the fire/shooting function which is inside of the skeletalmeshcomponent

#

ye, i feel like though the best way would be to start with blueprint first then c++ xd

thin stratus
#

Okay, so, THAT is not a reason to RPC or Replicate in the weaponComponent

#

If you want that Projectile to show on everyone, then you need to spawn it on the Server and mark the BP/Class of your Projectile as Replicated

#

What is calling that ::Fire() method?

magic furnace
magic furnace
#

it's on playfab, I can join, I can't see it in my own browser at least

#

haven't actually checked the steam one

thin stratus
#

So that's two different things though right

#

PlayFab is joining via IP

#

Browser is joining via Session

blissful island
thin stratus
#

Or well PlayFab is joining via steamID that is gained by IP

#

iirc

#

something like that

magic furnace
#

but the server needs to auth with steam or whatever

#

so I get the steam id

#

which works

thin stratus
magic furnace
#

yup

#

it even creates one by default

thin stratus
#

The Fire call and the Input is all local

#

You need to ServerRPC the Fire call

magic furnace
#

which it seems like I have overwritten by using your code for RegisterServer

thin stratus
#

And mark the Projectile class as replicated

#

That's the naive solution for now at least

magic furnace
#

if it even creates the session there

thin stratus
#

By default, a DediServer does not create a Session

magic furnace
#

It does

#

apparently

thin stratus
#

It shouldn't. The RegisterServer function is empty native

magic furnace
#

since if I try to create my own

#

it says a gamesession is already present

thin stratus
#

void AGameSession::RegisterServer()
{
}

magic furnace
#

yeah I saw that

#

which is confusing to me

thin stratus
#

it says a gamesession is already present
I mean, you must be knowing where you call your CreateSession code, right?

magic furnace
#

see that's the thing

#

I never ever do

#

it apparently does so by default

#

people on the forums said the same

thin stratus
#

That's news to me though

#

Like, I'm sure DedicatedServers do not just try to blindly create a session

#

Maybe Steam does something when the Server logs in

#

But I wouldn't know why and how

#

Like what SessionSettings does it use?

#

How many slots?

#

etc.

magic furnace
#

LogOnlineSession: Warning: STEAM: Cannot create session 'GameSession': session already exists.

#

this is what I get when I try to create my own

#

I have not actually printed the settings it tries to use by default

magic furnace
#

not a multiplayer question

elder lynx
rain condor
magic furnace
#

it's completely unrelated to multiplayer

#

by this logic anyone who has any question and is developing a multiplayer game should ask here and flood it

#

there is no replication involved, just animbp

rain condor
#

Ok

thin stratus
#

I feel like the "Creates a Session for you" on the internet is people not understanding what a session is

#

I think they believe that a Session and the LISTEN part is the same

#

Cause as a ListenServer you have to open the game with ?listen and most people have a CreateSession before that

#

And they might not get that these are two different things

#

You can connect via IP to the DediServer, but that doesn't mean it has a Session

blissful island
thin stratus
#

Seems also like no one ever confirmed that it actually creates a session

#

Whic hwould also be news to me

thin stratus
#

Server RPC and then spawn the Replicated Projectile

blissful island
#

ok, ill try

magic furnace
#

and as noted have tried getting my own session running, but it tells me there is one already

thin stratus
#

Yeah of course you aren't

#

You have a DediServer :D

#

The thing about there being a Session already is strange

magic furnace
#

the only time I create a session on my own is in my host button

thin stratus
#

Can you enable more logging for the LogOnlineSession categoryß

#

So you can see what is creating that session?

magic furnace
#

how can I do that?

#

I would love more logs as well

thin stratus
#

Since it's a DedicatedServer, you'd need to set that up in the ini files of it

#

Cause after start it's too late

#

Can never remember how that works, one sec

magic furnace
#

okay, is it some setting? docs would be appreciated for the future

#

will look on my own too

thin stratus
#

DefaultEngine.ini

#

Find or Add the [Core.Log] Section

#

Add LogOnlineSession=Verbose below it

#

can also try VeryVerbose

#

ini of the Server of course

magic furnace
#

yup, on it

#

gonna reupload, get my test hamster to launch it

thin stratus
#

I mean

magic furnace
#

since I have yet to set up the whole local multiplayer

thin stratus
#

You can test that locally too, right?

#

Doesn't need to run on PlayFab for this

#

The Session stuff should be executed locally too

magic furnace
#

yeah, it's just I am a lazy person, and would have to run the local multiplayer agent, since it doesn't launch cause of the gsdk by default

#

I will set it up after this

#

high time

thin stratus
#

H right

sudden condor
#

anyone have a pointer to a good pregame lobby tutorial? I just need the backend architecture, I can't wrap my head around where to handle people joining the host. I don't see an "on player join" event in the level blueprint.

sudden condor
magic furnace
#

that's what you're looking for

magic furnace
#

which build setting is it

sudden condor
magic furnace
#

since it seems it's not for me?

magic furnace
#

level bp is basically deprecated

sudden condor
sudden condor
magic furnace
#

and basically always not the best place to put anything

sudden condor
#

so just have a main menu gm and a lobby gm, etc.

magic furnace
#

yup

#

gamemodes is where you put that, or player controllers since that makes more sense

#

for UI related stuff generally playercontroller/character

magic furnace
#

so u would just have a mainmenuHud in the gamemode

#

and set it as default

sudden condor
thin stratus
magic furnace
#

I am in development

#

and well they're not there

thin stratus
#

No config folder at all?

magic furnace
#

im going to check package settings

magic furnace
thin stratus
#

Then just set it before packaging I guess

#

In the project one

magic furnace
#

yeah, was what I was going to do

#

but it should be in package

#

so gonna check my settings

thin stratus
#

Package has it in Saved/Configs maybe

#

Not sure

magic furnace
#

maybe unticked it somewhere

queen escarp
#

How can i make this visible for only the owner of the other component ?

magic furnace
thin stratus
#

I have a Saved/Config/Windows folder

#

Maybe you gotta run it once

queen escarp
#

the owner is an "actor" in the server i suppose :/ ?

thin stratus
#

Well, what actor?

#

Are you expecting a specific one?

#

Otherwise you could try to GetOwner on the Component and then work with the local role

magic furnace
magic furnace
#

yeah, the folder is there

queen escarp
#

no owner i suppoose ?

magic furnace
#

no defaultengine.ini

#

just gonna package it, takes a second

queen escarp
#

hm

thin stratus
queen escarp
#

the actor itselfs shows the widget so hmm

thin stratus
#

Only the actual ones

thin stratus
queen escarp
#

yeah

thin stratus
#

And the Actor that overlaps is supposed to be the Player?

queen escarp
#

yeah

thin stratus
#

Why are you checking for a Player tag on the Component?

#

That's so strange

queen escarp
#

why´s that ?

thin stratus
#

No one does that

queen escarp
#

if npcs or whatever overlapp i dont want it to change ?

thin stratus
#

The Tags are prone to typos

#

Okay so

#

Take the OtherActor pin

queen escarp
#

yeah i know but its from my "Wc3" modding days lawl

thin stratus
#

And cast it to your PlayerCharacter class

queen escarp
#

ok

thin stratus
#

If your AI and your Player share the exact same Class and this would work for AIs too, then you can check if the Controller is valid

#

If not Valid, then who cares, you just don't show the widget

#

If valid, you can check if it's an AI Controller or not

#

And if they don't share the same class, then that's not a problem at all

#

Then you just call IsLocallyControlled on the cast result

#

And only show the widget then

#

The IsLocallyControlled part is needed for both cases

queen escarp
#

yeah but do i need to check if valid really ?

#

something like this

magic furnace
#

why the tag still

thin stratus
#

The Tag is really not something you should use

queen escarp
#

well this worked like a charm so

#

what really 😮

#

i use it all the time lawl

thin stratus
#

There is no reason for it

queen escarp
#

ok but then a question about this

#

when im using a cast like this

#

wont that "recast" each time something overlapps ?

#

isent that costly

thin stratus
#

Yop it does and not it's not

queen escarp
#

since ppl say dont cast

magic furnace
#

tags are good, but for the right use case

thin stratus
#

People who say Don't Cast have no idea what they are talking about

#

Don't use Tick
Don't cast
Don't do xyz

#

They don't explain why and when

queen escarp
#

orl ? so i shouldent bother thinking about how "not to cast" ?

thin stratus
#

Correct, if casting is the correct solution for your problem, cast

#

If you can improve the solution by casting less, sure, but not if it removes the cast fully

queen escarp
#

@magic furnace yeah well since im still lerning obvi its stuck on me from wc3 modding since u tag everything there (oldschool)

#

hm alright

thin stratus
#

There are also people who say "Cast once and save the reference". which in theory is good, but not if the original thing you cast can change and go out of sync with your saved ref

#

So in theory, just freaking cast

#

In all kinds of situations, just do the thing that is correct and makes sense

#

When you have a game that can be shipped and it lags, profile it and improve it

#

I'm sure that overlap cast will never show up

queen escarp
#

hm ok

#

good to know

#

thanks

thin stratus
#

Also, I honestly NEVER have used Written Component or Actor Tags

#

Never

#

Not in the 7+ years I'm using this engine

#

And I will probably never use them

#

If I ever need to tag something ,I use a GameplayTag

queen escarp
#

but then how would u seperate it

#

i mean for instance

thin stratus
#

Player vs AI you mean?

queen escarp
#

how would u linetrace

#

without tags?

thin stratus
#

Two options

#

If your Player and your AI control the exact same Character Class, you can test it via teh Controller

#

Or, better, you just give them two different classes

elder lynx
#

Does anyone knows why physics stops working on player when it is disconnected from server. In this case we are not destroying the pawn and storing its reference in player state.

queen escarp
#

their own channel is 1 option but thats just alot more work*

#

hm

#

but if i wanna have different kinds of AI and them reacting differently to the trace

#

like mob 1x take 2x damage mob 2x take 5x damage

#

this is a simple way of seperating it

magic furnace
#

biggest problems stem from referencing data through hard references

#

so while the casts wouldn't be the cause

thin stratus
magic furnace
#

they would be part of it

thin stratus
#

If you want different AIs to behave differently, then you have code in a shared parent that each AI overrides

magic furnace
#

it's better to tell new people to not cast for that reason, they will eventually learn when to and how to soft reference and decouple

thin stratus
#

And if you really need meta data

#

Like "Is this a Monster or a God"

#

Then you can use GameplayTagContainers

queen escarp
#

hmm mkay

thin stratus
#

But I would still leave them on the Character Parent class

#

But at that point you might as well as GAS

queen escarp
#

but is my way "wrong" in what sense preformance wise or just bad programming ?

thin stratus
#

Bad Programming in the sense of: There are better alternatives.

queen escarp
#

or just less efficiejnt

#

yeah but "preformance wise" it dosent matter right

thin stratus
#

And also might scale really badly

#

Like how many ORs and ANDs do you want to put there?

queen escarp
#

yeah sure sphagetti

thin stratus
#

AND is Monster OR is Paladin AND is God

queen escarp
#

yeah i know

#

thats why i agree its "messy" but i mena it not "WRONG" its just a bad way of doing it right ?

thin stratus
#

Theoretically each of your Characters should have specific Stats and fwiw Meta Tag in form of GameplayTags.
And when you deal damage some generic function should figure out the damage based on those stats/metadata and apply it.
And if someone has to react differently to the damage then you handle that in a child class

thin stratus
queen escarp
#

ok but thats good to know i will try to stay away from it

#

good practise

#

practice

#

also maybe unrelated but still multiplayer, im doing a "listen server fps" game and my listen server(client) runs smootly but my 2nd client is laggy asshell what would be the reason for that ?

#

the project is new since like monday so not much in it

real ridge
#

LineTrace vs "Real Bullets" in mp ? I use LineTrace but I am facing some problems with aiming when I am too close I cant shoot in middle etc

thin stratus
shrewd tinsel
#

hi. i have a variable 'HasRaceStarted?" on my gamestate

#

why isnt it replicated when client joins the server?

#

if i join the server when the race has started, the bool on client is false, do i have to do an rpc to set these important variables when client joins?

thin stratus
#

@shrewd tinsel Show the Variable please

faint cloud
#

hey guys can someone plz help me on how to make a OnRep function for these guys?

{
    if (TileRef)
    {
        TileRef->AddBuildToQueue(Build);
        UE_LOG(LogTemp, Display, TEXT("Server_AddBuildToQueue_Implementation was called"));
    }
}```
 hey guys how can i make the client know about this funct?
thin stratus
#
  1. Please us IsValid to check UObject Pointers
#

So if (IsValid(TileRef))

#

Cause that also checks for PendingKill

faint cloud
#

ok ill do that will that notify client though?

thin stratus
#

No, that's a general thing

#

What do you want to notify the Client about here?

#

The BuildQueue?

faint cloud
#
{
    Server_AddBuildToQueue(Build, TileRef);
    UE_LOG(LogTemp, Display, TEXT("ProduceBuild Was called"));
    UE_LOG(LogTemp, Warning, TEXT("MyFName variable: %s"), *Build.ToString());
}

the client knows about this

#

this func calls the first func

thin stratus
#

Who all needs to know about this? Only the Local Client and Server, or Everyone?

faint cloud
#

every client

thin stratus
#

Is your AC_Tile actor replicated?

faint cloud
#

and server

#

the class is

thin stratus
#

Show me AddBuildToQueue

faint cloud
#

like the actor class has set replicatesto true

#

ok

thin stratus
#

The two functions you posted are fine. The replication has to happen in the Tile Actor

faint cloud
#
    void AddBuildToQueue(FText Build);```
thin stratus
#

The definition of it :P

faint cloud
#

yeah i realized that lol

#

prob still not gonna work though idk lemme see

faint cloud
#

its a UFUNCT?

thin stratus
# shrewd tinsel

That variable is marked as replicated. Who is setting it to true?

thin stratus
#

The actual stuff it does

faint cloud
#
{
    if (bFoundFirstTrueElement == true)
    {
        BuildProductionQueue.Insert(Build, FirstTrueElementIndex);
    }
    else 
    {
        BuildProductionQueue.Add(Build);
    }
    UE_LOG(LogTemp, Display, TEXT("bool Added To Queue."));
}```
shrewd tinsel
#

and the client joins 30seconds later

thin stratus
#

One thing that is a bit strange is that you use FText for this stuff

#

But let's ignore that for now

faint cloud
#
    TArray<FText> BuildProductionQueue;```
thin stratus
thin stratus
#

Do you want to be notified about that array changing or what's the problem?

shrewd tinsel
faint cloud
#

only works for server

thin stratus
#

If the client does it

faint cloud
#

well in the player controller lemme pull it up

#
{
    Server_AddBuildToQueue(Build, TileRef);
    UE_LOG(LogTemp, Display, TEXT("ProduceBuild Was called"));
    UE_LOG(LogTemp, Warning, TEXT("MyFName variable: %s"), *Build.ToString());
}```
#

that funct works

#

all prints call

thin stratus
#

Okay

#

And further? Where does it stop?

faint cloud
#
{
    if (TileRef)
    {
        TileRef->AddBuildToQueue(Build);
        UE_LOG(LogTemp, Display, TEXT("Server_AddBuildToQueue_Implementation was called"));
    }
}```
#

but here

#

it stops working

#

for the client

hazy ether
#

Did you do the doreplifetime thing?

thin stratus
#

So

#

That would mean the TileRef is invalid

faint cloud
thin stratus
#

Which would only happen if either the Client passed a nullptr

#

Or the Actor is not replicated

faint cloud
thin stratus
#

Well the Actor itself

queen escarp
#

any idead eXi ?

thin stratus
#

Otherwise that pointer can't be communicated

queen escarp
#

ideas*

faint cloud
#

how i do that?

#
{
     // Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
    PrimaryActorTick.bCanEverTick = true;

    TileComponent = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("TileComponent"));
    TileComponent->SetupAttachment(RootComponent);

    static ConstructorHelpers::FObjectFinder<UMaterial> FoundMaterial(TEXT("/Game/TileColor.TileColor"));
    if (FoundMaterial.Succeeded())
    {
        SourceMaterial = FoundMaterial.Object;
    }

    SetReplicates(true);
    SetReplicateMovement(true);
}```
#

its got replicates on

thin stratus
#

How are you spawning those tiles?

#

Server must spawn them fwiw

#

And only the Server

#

Or preplaced into the world fwiw

faint cloud
#

yeah they are preplaced

thin stratus
#

can you confirm in the PlayerController function that the TileRef is valid?

#

Cause you never test that

faint cloud
#

ok

thin stratus
#

Maybe it's null there already

thin stratus
queen escarp
#

hm okey maybe its on my end due to 2x clients perhaps,

#

1 last quewstion

#

when using "repNotify"

#

if i were to use it in this case and jsut change the variable locally would it still be updated to the server ?

#

is that like how u use it ?

faint cloud
#

so i was thinking of an OnRep function?

#

but theres no varaible to ReplicateUsing?

faint cloud
thin stratus
#

Again yeah

thin stratus
#

Is it null there already or not?

faint cloud
#

its still null

thin stratus
#

The only thing RepNotify does is call a function when the value changes (in BPs)

queen escarp
#

ohhh

#

ok i get it

thin stratus
#

You always have to set them on the server

queen escarp
#

yeah i know i just like it more being told like im a toddler then reading

thin stratus
queen escarp
#

okok

thin stratus
#

Apparently you are passing null into it @faint cloud

faint cloud
thin stratus
#

What is calling that PlayerController function

faint cloud
#

this

thin stratus
#

There is no "make it valid" if it's already null when you call this function

faint cloud
#
{
    APlayerController* PlayerController = GetWorld()->GetFirstPlayerController();
    AC_NationsPlayerController* NationsPlayerController = Cast<AC_NationsPlayerController>(PlayerController);
    if (NationsPlayerController)
    {
        NationsPlayerController->ProduceBuild(SteelFactory, InstanceOfC_Tile);
        UE_LOG(LogTemp, Display, TEXT("Build Was Produced"));
    }
}```
thin stratus
#

And what is InstanceOfC_Tile?

faint cloud
#

its a passed refrence from the selected actor

thin stratus
#

That's probably already invalid there, can you check?

faint cloud
#

ok

thin stratus
#
if (NationsPlayerController && IsValid(InstanceOfC_Tile))
{
    NationsPlayerController->ProduceBuild(SteelFactory, InstanceOfC_Tile);
    UE_LOG(LogTemp, Display, TEXT("Build Was Produced"));
}
#

If it's invalid, the prints should already stop here

faint cloud
#

ok yes its valid

#

because all the UELOGS work

#

except for the server function

thin stratus
#
void AC_NationsPlayerController::Server_AddBuildToQueue_Implementation(const FText& Build, AC_Tile* TileRef)
{
    if (IsValid(TileRef))
    {
        TileRef->AddBuildToQueue(Build);
        UE_LOG(LogTemp, Display, TEXT("Server_AddBuildToQueue_Implementation was called"));
    }
    else
    {
      UE_LOG(LogTemp, Display, TEXT("TileRef is Invalid"));
    }
}```
#

Use that for the Server function

#

For now

faint cloud
thin stratus
#

But yeah, if the TileRef doesn't make it to the Server, then that's usually cause it's not replicated.. hm

rose pollen
#

is building shipping for the client and development for the server likely to cause any issues, do they have to match?

thin stratus
#

No, that's fine

faint cloud
#

its not declared in the player controller?

thin stratus
#

Is that maybe not marked as replicated for any reason?

faint cloud
faint cloud
#

it was giving me an error about that

thin stratus
faint cloud
thin stratus
solar adder
#

A stupid question - is doing a multicast, and iterating over player controllers in game Mode and calling some Rpc on each roughly the same thing?

thin stratus
sudden condor
#

What's the angle for making a "ready up" system? I have a bool var in the game controller, which also has an array of player controllers each with their own bool var, how do I efficiently take a live "and" of all the players' bools?

thin stratus
#

PlayerState is for shared Data between one Player and other Players

#

GameState has a PlayerArray that is "replicated" to all Clients, which contains all PlayerStates.

sudden condor
dark edge
#

Bool change -> are all of them true? -> lets go

#

GameState would probably be the place with an onrepped variable for the game phase state

sudden condor
#

yeah I don't think I'm really grasping the concept here

dark edge
#

When you change the bool, also check if all bools are ready

#

Onrep is a great way to do stuff when you change a variable

sudden condor
#

So I have this state object, with an array of bools that the controllers access?

dark edge
#

in BP it runs on server too, in C++ you need to call it manually

#

No, you have 1 bool per PlayerState

#

You already have a state object per player

#

playerstate

#

as the name suggests

sudden condor
#

which is a seperate thing from the controller right

dark edge
#

When that is changed, notify GameState and let GameState determine if it's ready to progress to the countdown or whatever

#

yes

sudden condor
#

so do I gotta make that or.....is it already in something

dark edge
#

It's a built in class, you make a custom PlayerState just like you've already made a custom pawn and playercontroller etc

sudden condor
#

ugh thats like the 10th class I need for this lmao

#

I knew making a menu would be annoying but jeez

dark edge
#

A custom playerstate, gamestate, gamemode, playercontroller, pawn are pretty much the basics

sudden condor
#

yeah

#

then widget, level, level mode for each menu lol

dark edge
#

wait till you gotta actually make the game

#

you gotta make all of it

sudden condor
#

nah that was done frst because I'm impatient

#

then I did the menus

shrewd ginkgo
#

adriel

#

can you help about random mesh on same pawn class
I want to do 8 diffrent mesh in game every one must have different mesh

#

we talk about it this morning

sudden condor
#

pretty sure that would work

shrewd ginkgo
#

is everyone diffrent in it

#

all of 8 players must different mesh

queen flower
#

How do you handle updating balance data for your multiplayer game? Currently using google spreadsheets, exporting a file, then uploading to game server, then in most cases players have to restart their game. Hoping to propose a method using in-engine data tables. Any input is appreciated! 🙂

sinful tree
# shrewd ginkgo can you help about random mesh on same pawn class I want to do 8 diffrent mesh i...

Create an array containing your meshes either within Game Mode or Game State.
Add a replicated mesh variable w/ notify on the pawn.
After spawning it, grab a random mesh from your array and store it in a variable temporarily.
Remove the mesh from the array using that variable.
Set the replicated mesh variable on the pawn to the temporarily variable.
Use the OnRep function on the pawn to then change the displayed mesh to the replicated mesh variable.

#

So long as all the meshes within the array are unique, each pawn should then get a different mesh. This'll only work up until you run out of meshes of course. Managing what happens to meshes when players disconnect etc. is further work.

shrewd ginkgo
#

ty

sudden condor
sudden harbor
#

All replication consists of is going through the server and then multicast to all other clients?

#

Like: Client > Server > All Clients

fossil spoke
#

@sudden harbor Not necessarily.

#

If you want other Clients to know about something that is one option.

#

The alternative depends on what your needs are.

#

Sending an RPC to the Server (from a Client) and then modifying a Replicated variable will have a similar effect.

#

Since the replicated variable will be updated on all Clients when set by the Server.

sudden harbor
#

Ahh ok

sinful tree
#

In some cases, you don't even need a client to call to the server.... The server itself can do things like detect overlaps, and will have its own begin play starts of actors, etc.

sudden harbor
#

Do you think what I have done with the pickups above is ok?

sinful tree
#

No.

sudden harbor
sinful tree
#

Begin play fires on clients and server. Marking an event as "Run On Server" indicates that you want a client to be able to call that event, but they could only do so if this actor was owned by a client. By the name of the actor, I can tell that this likely would not be a client owned actor, so you do not need any Run On Server events at all within it as it should be entirely managed by the server.

Use a "Has Authority" node on Begin Play and if this actor was spawned on the server then the "Authority" path will be executing on the server.

If your "RespawnPickups" function spawns a replicated actor, then all you would probably need is that looping timer. No other RPCs required.

#

So then this actor becomes:
Begin Play > Has Authority (Authority) > Set Timer By Function Name (RespawnPickups)

sudden harbor
#

It is a pickup manager blueprint dropped in the world. So, checking if Has Authority or Is Server will be a better approach?