#multiplayer
1 messages · Page 109 of 1
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 ?
Yes
ok and RepNotify dose what ?
i know i can google but better to be explained from the pros
Luckily these "pros" have written articles about this very thing. Even better - it is in the pinned resources.
lucky me X=)
Rep Notify gives you a function that is executed on clients (and server in blueprints) when the value is changed.
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.
can I set player controller class in blueprint?
here, during beginplay event on the controller
Are you receiving any errors in your log when you have the looping bit hooked up?
yes there was one error that said wb_lobbymenu isnt valid
Can you provide a screenshot of the error?
i'll try to recreate the error, wait
No. It's defined by the game mode being used for the level. There is a way to set the game mode independently of the level when opening a level using the options string, something along the lines of ?Game=<insert project relative path to game mode>
its working now and doesnt give any error for some reason
i was working on that code yesterday and it was giving error then
Glad it's working then 🙂
fixed it by doing these two commits the top ones of today
https://github.com/Yalenka/SurvivalGame/commits/main
it was needed custom replication to handle it in my case
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
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.
guys how can ı do multiplayer doors my doors isnt working
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
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
Share SS of your Animation blueprint , how you set the Value to the blend space and how you get the value in the anim graph
Replication works one way, from server to Client
yes
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
and multicast the input, sound brutal ^^
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
again, I could be wrong as I don't make MP game hopefully someone can show their workflow
yeah yeah but let's dig this way
and yes if someone can show their workflow
thanks anyway, i look
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
Bad arrangements, but it work
Run on server event
some other things to fix, but thanks @dark parcel , i got a way to explore
@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
so saving stuff "locally" would be best place there right ?
wdym by map load exactly
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
oh yeah i mean, when u change game modes, player controllers etc etc
oh right, for each client right ?
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
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
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
hi, does bAlwaysRelevant only effect the network update of the actor, or it will get rendered in the client too?
Is any Firebase(sort of free online db) analogue for Online Steam Subsystem or I will have to connect to Firebase via http reguests?
im new and wanna know how does multiplayer works of ue ty in advance
It means that the actor will send updates to all clients always. This has zero effect on the net update frequency of the actor, which means how often the actor will send updates. An always relevant actor doesn't need to render on client, it can have no physical representation pretty much like it's the case for GameState
Pinned messages will help you
OSS is an "interface" that describes how a certain platform reacts to certain events. In terms of UE, it's literally an Object class. The former is usually an external database which you need to communicate with via backend services
ok but if i want a dedicated server for it then what would you recommend like the ue subsystem or is there something better?
Literally opening the editor and choosing to "play as client"
wont it allow easier hacks?
Your terminology proves that you still lack experience, so you need to learn the basics first
Go to pins, start reading
yes ik
ok thanks
I make a password system for lobby but its not work
I cant get it whats the problem. How can I solve it
ok so just by adding this one in the game mode
then my character dosent spawn at all ?
You need to call parent implementation
meaning ?
call to parent function ?
Yus
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 :&/ ?
That InputMode event is local only
You are calling that on Server-side
Yes
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
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.
GameMode only exists on the server, so attempting to Multicast from there is pointless as no clients can receive the message.
ahaaa ok
What you're trying to do there can be accomplished on Begin Play of the Player Controller.
yeah im just messing about trying to learn
so player controlelr is both server side/ client same as the character right
Yep
But only for the client that owns that player controller. It's not accessible to other clients.
hm ok,
and the game instance
is only 1 locally per client ?
nothing on server side on that one
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.
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
is WithValidation actually required in c++? I heard some people say it might not be
It isn't as of the newer versions
Defo not in UE5, maybe not around 4.20+
can anybody help me for this password system for lobby. I can get whats the problem.
Alright, thanks
ServerMenuRef is invalid when you try to access it. The error tells you what's wrong.
You’re setting the variable to true in both cases
Wait they’re separate variables…?
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
i tried doing this but it didnt work either
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?
ok ill try
worked
ty
Np
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
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.
when you say "has authority (authority)" > to gate..." you dont mean the "gate" blueprint like for mostly used with doors, right?
nvm got it figured out, ty 🙂
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.
Is your custom game mode based off of GameMode or GameModeBase and are you using the accompanying GameState or GameStateBase?
Did you set the world settings of the level you're using to use your custom GameMode?
GameModeBase
And no to the world settings.
Will do that
and I havent even put a GameState class in the game as of yet.
Thank you, it was indeed the world settings not having a game mode.
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
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.
Is there any way to override replication behaviour for member properties in a child class?
In C++ yes, in blueprint I don't think so.
Thanks!
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
What's the mechanic? Sounds like a map of name to whatever type the value is or a struct with a name and value field.
it is
So either use a map or a custom structure or 2 parallel arrays
im on 5.1 and soemone told me me to look for 'map' variable type but i dont have it
Yes you do. Maps don't replicate tho if that's a thing you need.
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
if u know of a method
Creating and editing Map containers, an advanced container type, in Blueprints, including an overview of this container's properties.
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
If I pass an array through an RPC that's replicated will it still share the same reference? What about a a TObjectPtr?
If you call a ServerRPC into a Multicast, and you want to also call the Sound locally to predict it, you'll need to filter the Multicast Call with IsLocallyControlled or similar (depending where you are) to skip it for the client who already played the sound
Only if the Objects are replicated
or assets fwiw
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?
Replicated Actors, if by then spawned and replicated, will have a valid reference in the array usually
+- relevancy
yup i fixed it thanks tho!
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
They aren't really replicated functions. Replicated actors being spawned/destroyed is just replicated.
Yeah i shouldn't have asked the first question
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 🙂
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.
what can i do for fixing ClientEncryptionKey must contain 64 hex characters
There will always be a correction since the character is forward-predicted by the client and smooth-sync/physics is not.
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
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.
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
I'm fairly sure character movement doesn't handle the character being attached to things
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
Yeah :/
Rewriting the movement component for a character basically is what I though I was going to avoid 😄
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
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)
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
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.
You shouldn't need to do a multicast.
Run On Server > Line Trace > Set Members > Destroy Actor should be sufficient.
What you may need to do is actually set the structure variable after the "Set Members in struct" - I can't remember exactly, but sometimes manipulating variables in such a way fails to trigger onreps/replication?
I was already doing "Run On Server > Line Trace > Set Members > Destroy Actor". As you said, I set the Struct variable after Set Members, but nothing changes. Still same:/
I think the problem comes from here. This is the action of doing "empty" when pressing the G key. RPC didn't work.
You're not supposed to empty the structure by that point - it should be handled in the RPC otherwise the server will think your structure still has an item.
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.
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?
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)
I want to go piece by piece. (I've been dealing with this for 2 days.) The first photo, that is my pick up system, is it correct?
If it's correct, I will prepare the Drop system. (I hope it's correct)
The only thing I'd do different here is not have the client sending the vectors in the RPC. The server should be able to read those values itself.
I did not quite get it. Is it wrong
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.
Oh okay. Thanks for this information.
Here is the 2nd photo.
Drop system, but it didn't work :/
RunOn> Multicast or RunOwningClient did not work either
Again, feeding too much information to the server.
Drop Input > Server RPC > Server determines what slot the player is currently holding > If that slot has something > Change the Structure > Spawn the item
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.
I think there is no problem in the pick up section. But, I couldn't understand anything in the Drop part. Any chance of sending an image? or blueprintue. Please excuse my ignorance...
Best I can do...
Input > Run On Server > Server Does the Logic & Sets Variables
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
Game Instance runs on every Instance of the game that is running.
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.
Thank you so much I'm trying
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.
Game Mode only exists on the server. Clients cannot access it at all.
Game State exists on clients and server. and It is replicated.
Good stuff, then my understanding is correct at least, now maybe you or someone coudl tell me what im doing wrong with this delegate binding
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
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
ahhhhh, now there is a method I didnt know existed yet.
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.
any possible fixes for this?
@sinful tree The problem solved
I also ran the Enum itself on Server, problem solved.
Thank you so much!
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
What is the proper way to get the netmode in a blueprint?
Don't think you can.
Closest you can do is something like this...
how can I give different mesh for every person who enter map. Everyone must have diffrent mesh
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
@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.
its not failing TO search, its just not finding what its supposed to
at least thats what I see so far
Then its likely the Session doesnt have the right settings
hmmm
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?
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
The Logs should tell you
but I do know that the IP connection is working
Yeah thats just saying the server exists
Not that its searchable via session handling
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
The Session interface should give you more information
thats coming from my on session complete delegate
[Core.Log]
LogOnline=Verbose
LogOnlineSession=Verbose
Add this to your DefaultEngine.ini
These will help print more information to the Log
I did what you mentioned with the logging. I noticed one thing that I didnt before. It seems like my client is starting my dedicated server when in PIE.
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?
Honestly I would separate this from the GameInstance
Put it in a GameInstance Subsystem instead
please do, direct me with a better approach
this is my first naive attempt through this
how can I give different mesh on same pawn for every player who enter map. Everyone must have diffrent mesh
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
@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.
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.
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.
Shit yeah. im glad I got this finally figured out. This has been a nightmare.
2 days spent scouring docs for that answer
lul
I love this discord. This place has sped up my rubber ducking 10 fold.
is there a list of data types that are supported for replication?
Is there a specific type you are curious about?
TMap and TArray
TArray is, TMap is not.
and also wondering if the types of the TArray matters
TSet is also not able to be replicated
what about structs?
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
I see. thank you so much for the clear explanation
Will TArrays be replicated regardless of type?
and if it's a TArray of a UStruct, does this same rule apply?
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.
Okay, thank you
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.
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
Is there a way to get ip information from FOnlineSessionSearchResult?
Im just curious about how the SessionInterface->JoinSession() works
How does it resolve
You need to join the session to get a connection string from it afaik
Search for FNetFastTArrayBaseState
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
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?
Blueprint or C++?
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
i tried using that and it worked but it stops working if the player dies and respawns
How do you mean?
Where are you using it?
How are you accessing that function?
GetPlayerController is a static function.
im using it here. this function executes on tick on all player pawns except if they are on local machine.
im still a beginner in networking so idk if im doing smth wrong
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 Try this.
I assume this is happening because Im using NULL as my OnlineSubsystem?
ok, i'll try. thanks
Potentially. Ive not used Sessions with OSS Null so it may just simply not support it.
its working ok on clients now but doesnt work at all on the listen server
Its likely that it doesnt. Since you need an underlying platform (like Steam or EOS) to deal with the session handling
Show your code as it is now
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
It takes time.
everything works now. thanks so much man
👍
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
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.
do sounds need to be Rpcs so other player hear is ?
even if its play sound at location ?
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?
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
I think you need to elaborate on "progression" a bit more. Progression can be altering an entire world or simply being a skill level going up per player. All of those systems can wildly differ from each other 🙂
Thanks for the answer, where progression is in terms of players, when player interact and doing things in the world it will increase his XP and after match will game xp add to his xp. But yea, player levels that are going up per player is the one. So let's say from level 1 to 100 and on each level player can unlock various things for gameplay
https://www.youtube.com/watch?v=VjSMKImHab4&list=PLzykqv-wgIQXompUswD5iHllUHxGY7w0q&index=19&t=2966s&pp=iAQB
idk if linking yt is allowed in this server but this tutorial will help you
Check out my Patreon: https://www.patreon.com/user?u=60713904 Become a member: https://www.youtube.com/channel/UCFjBMoGhlEum8jRgPvmWpJg/join
Join the {GDR}; Discord server and download my free project files: https://discord.gg/dUm3ZtYDuV
Buy me a coffee: https://ko-fi.com/bluntstuffy
Follow me on Twitter: https://twitter.com/BluntZombie
Rank ic...
@chrome bayi mean im my case doing a fps when a player fires then a person close wants to hear it
Don't do that. Do someting like this:
https://jambax.co.uk/better-burst-counters/
how can I give different mesh on same pawn for every player who enter map. Everyone must have diffrent mesh
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.
You mean pawn class right?
You want everyone to have a pawn of the same class but with a different mesh, right?
Or.do you want 1 actor to look different for every client?
It's all just functions and data.
You have xp, level, and xp to level as data. When you get xp, run a function to check if xp > xp to level.
When you level up, you'll run a bunch of functions, some of which will be to do stuff based on the new level (unlocking things, etc)
yes
Thanks for explaining, what do you think is the proper objects to use, could it be component to give an an certain xp if you do something, and then everything that gives you an Xp should have that or it can be UGameInstanceSubsystem to keep all information there?
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
@chrome bay only using bp´s :/ sry
right, can you help?
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
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.
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
if your aimoffset is replicated correctly, than you have issues with the 3rd person camera location attached to the character
if you are using only one camera which is first person, attach it to the head socket
It's attached
if you look up/down, the client can see your movement?
Yep
look and sky and show me how the offsets are calculated?
take a screenshot
Here is aim offset
seems like everything is correctly working
Yep i know
Haha
I used this function to align 1st person gun to camera
1st pic is align, second it's without function
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.
@chrome bay why wouldent i rpc. Sound like that btw :/?
alternative to 'was actor recently rendered' node for mp?
oh it is indeed the query port
my bad
now the only problem is the server browser not finding it
otherwise all working
hi, anyone know if there is a way to replicate or make rpc call in skeletalmeshcomponent in c++?
Theoretically if you inherit from it, mark it as replicated and place that on an client owned actor, you should be able to perform RPCs and replicate stuff
you mean i should make variable of the skeletalmeshcompnent in an actor script, then make rpc call in there?
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.
Eh, no. I said you need to make your own child class of SkeletalMeshComponent if you want to make RPC calls in it or replicate stuff
The question itself is also very strange, cause usually people don't need to do that
I'm honestly not even sure if that's the way to go about it anymore
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
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
and unreal have put the fire code in a skeletalmeshcomponent
What fire code? There is no fire code in a SkeletalMeshComponent
firstpersonshooter project, when i create one, the shooting function is inside of a skeletalmeshcomponent
when i used playfab for matchamking i remember i didnt receive the the 7777 port in the json
I'm pretty sure you are mixing stuff up
SkeletalMeshComponents only provide SkeletalMesh rendering. There is no way there is actual shooting code in there.
unfort there is atleast in c++ xd, for more specific it in unreal 5
ur porbably gonna need to ping the ip from the virtual machine but im not sure, i didnt use the ping feature
i do know unreal 4 does not if im correct
So the First Person Template?
yes
Please share the code that is apparently inside a SkeletalMeshComponent and that shoots
oh i didnt notice u figured it out, feel free to ignore my messages lol
I don't have the templates downloaded so I can't double check this
What in the absolute f*ck
ikr xd
Where is that code from? Is that literally generated from the Engine ?
yes
haha
but i think its for the action input
Well, sorry for doubting but that's just funny
np xd
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)
variables is fine, but its just that when i have to use "hasauthority" or "role" thats where the problem comes
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
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
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?
it is, literally nothing has changed, it works mostly, just can't see my bloody dedicated server in the browser
Your own?
Or the Steam one?
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
So that's two different things though right
PlayFab is joining via IP
Browser is joining via Session
i believe the input action by the looks of it
Or well PlayFab is joining via steamID that is gained by IP
iirc
something like that
but the server needs to auth with steam or whatever
so I get the steam id
which works
So you are creating a Session somewhere?
Right, the whole thing is set up for singleplayer.
The Fire call and the Input is all local
You need to ServerRPC the Fire call
which it seems like I have overwritten by using your code for RegisterServer
And mark the Projectile class as replicated
That's the naive solution for now at least
if it even creates the session there
By default, a DediServer does not create a Session
It shouldn't. The RegisterServer function is empty native
void AGameSession::RegisterServer()
{
}
it says a gamesession is already present
I mean, you must be knowing where you call your CreateSession code, right?
see that's the thing
I never ever do
it apparently does so by default
people on the forums said the same
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.
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
Any help here?
Does anyone knows about this?
But it's for multiplayer too
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
Ok
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
its not like BP where you make 2 custom events, 1 server and 1 multicast then call on each other so like
Main code -> Server -> Multicast (where the logic is), right?
Seems also like no one ever confirmed that it actually creates a session
Whic hwould also be news to me
You don't use a Multicast for this
Server RPC and then spawn the Replicated Projectile
ok, ill try
I do not open anything with listen and do understand the difference
and as noted have tried getting my own session running, but it tells me there is one already
Yeah of course you aren't
You have a DediServer :D
The thing about there being a Session already is strange
the only time I create a session on my own is in my host button
Can you enable more logging for the LogOnlineSession categoryß
So you can see what is creating that session?
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
okay, is it some setting? docs would be appreciated for the future
will look on my own too
DefaultEngine.ini
Find or Add the [Core.Log] Section
Add LogOnlineSession=Verbose below it
can also try VeryVerbose
ini of the Server of course
I mean
since I have yet to set up the whole local multiplayer
You can test that locally too, right?
Doesn't need to run on PlayFab for this
The Session stuff should be executed locally too
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
H right
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.
gamemode
on postlogin
ah gotcha
that's what you're looking for
btw shouldn't default engine be in my packaged game?
which build setting is it
So, much like the main menu, this is all the level BP should be?
since it seems it's not for me?
the level bp shouldn't even have that
level bp is basically deprecated
I see
interesting
and basically always not the best place to put anything
so just have a main menu gm and a lobby gm, etc.
yup
gamemodes is where you put that, or player controllers since that makes more sense
for UI related stuff generally playercontroller/character
yep
even further going specifically a HUD
so u would just have a mainmenuHud in the gamemode
and set it as default
Right, I worked with that a little as part of a niche function, but no unreal doc tutorials have gone over it
I think so yeah. You want to build DediServesr with Development usually
No config folder at all?
im going to check package settings
none it seems
yeah, was what I was going to do
but it should be in package
so gonna check my settings
maybe unticked it somewhere
How can i make this visible for only the owner of the other component ?
I checked all folders
Who is the owner?
the owner is an "actor" in the server i suppose :/ ?
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
probably
yeah, the folder is there
no owner i suppoose ?
hm
Yeah the Default ones aren't in the packaged versions I believe
the actor itselfs shows the widget so hmm
Only the actual ones
So the code you have there is in the pickup?
yeah
And the Actor that overlaps is supposed to be the Player?
yeah
why´s that ?
No one does that
if npcs or whatever overlapp i dont want it to change ?
yeah i know but its from my "Wc3" modding days lawl
And cast it to your PlayerCharacter class
ok
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
why the tag still
The Tag is really not something you should use
There is no reason for it
ok but then a question about this
when im using a cast like this
wont that "recast" each time something overlapps ?
isent that costly
Yop it does and not it's not
since ppl say dont cast
tags are good, but for the right use case
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
orl ? so i shouldent bother thinking about how "not to cast" ?
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
@magic furnace yeah well since im still lerning obvi its stuck on me from wc3 modding since u tag everything there (oldschool)
hm alright
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
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
Player vs AI you mean?
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
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.
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
not exactly true
biggest problems stem from referencing data through hard references
so while the casts wouldn't be the cause
they would be part of it
That is the wrong way of doing it
If you want different AIs to behave differently, then you have code in a shared parent that each AI overrides
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
And if you really need meta data
Like "Is this a Monster or a God"
Then you can use GameplayTagContainers
hmm mkay
But I would still leave them on the Character Parent class
But at that point you might as well as GAS
but is my way "wrong" in what sense preformance wise or just bad programming ?
Bad Programming in the sense of: There are better alternatives.
And also might scale really badly
Like how many ORs and ANDs do you want to put there?
yeah sure sphagetti
AND is Monster OR is Paladin AND is God
yeah i know
thats why i agree its "messy" but i mena it not "WRONG" its just a bad way of doing it right ?
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
Yeah but bad enough to call it out
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
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
What does "Laggy as hell" mean? Where is it laggy? Viewed from Server or the Client playing? Laggy in FPS or Ping?
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?
@shrewd tinsel Show the Variable please
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?
- Please us
IsValidto check UObject Pointers
So if (IsValid(TileRef))
Cause that also checks for PendingKill
ok ill do that will that notify client though?
No, that's a general thing
What do you want to notify the Client about here?
The BuildQueue?
{
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
Who all needs to know about this? Only the Local Client and Server, or Everyone?
every client
Is your AC_Tile actor replicated?
Show me AddBuildToQueue
The two functions you posted are fine. The replication has to happen in the Tile Actor
void AddBuildToQueue(FText Build);```
The definition of it :P
cuz its not a variable? so it cant have replicates?
its a UFUNCT?
That variable is marked as replicated. Who is setting it to true?
Show me the definition of that function please
The actual stuff it does
{
if (bFoundFirstTrueElement == true)
{
BuildProductionQueue.Insert(Build, FirstTrueElementIndex);
}
else
{
BuildProductionQueue.Add(Build);
}
UE_LOG(LogTemp, Display, TEXT("bool Added To Queue."));
}```
its set on server 4 seconds after begin play
and the client joins 30seconds later
Good, next up show me BuildProductionQueue
One thing that is a bit strange is that you use FText for this stuff
But let's ignore that for now
TArray<FText> BuildProductionQueue;```
That should work as far as I know
Yeah that looks good, everyone should have the correct values in that TArray
Do you want to be notified about that array changing or what's the problem?
ok thanks
yeah the prob is when the client tries to add to the queue nothing gets added except for when the server does it
only works for server
Do all the Prints call?
If the client does it
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
{
if (TileRef)
{
TileRef->AddBuildToQueue(Build);
UE_LOG(LogTemp, Display, TEXT("Server_AddBuildToQueue_Implementation was called"));
}
}```
but here
it stops working
for the client
Did you do the doreplifetime thing?
thats for actor though
Which would only happen if either the Client passed a nullptr
Or the Actor is not replicated
so tileref has to be replicated?
Well the Actor itself
any idead eXi ?
Otherwise that pointer can't be communicated
ideas*
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
How are you spawning those tiles?
Server must spawn them fwiw
And only the Server
Or preplaced into the world fwiw
yeah they are preplaced
can you confirm in the PlayerController function that the TileRef is valid?
Cause you never test that
ok
Maybe it's null there already
Not really at the moment ,no :<
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 ?
yeah its basically same result
so i was thinking of an OnRep function?
but theres no varaible to ReplicateUsing?
stilll there?
Again yeah
what do you mean?
Is it null there already or not?
its still null
No and I'm confused how you still ask these questions. :D The Compendium exists to answer that and you were pointed to it a gazillion times
The only thing RepNotify does is call a function when the value changes (in BPs)
You always have to set them on the server
yeah i know i just like it more being told like im a toddler then reading
Then what is calling that PlayerController function?
okok
Apparently you are passing null into it @faint cloud
ok so how should I make the TileRef valid?
What is calling that PlayerController function
this
There is no "make it valid" if it's already null when you call this function
{
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"));
}
}```
And what is InstanceOfC_Tile?
its a passed refrence from the selected actor
That's probably already invalid there, can you check?
ok
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
ThankYou ill just use that
ok yes its valid
because all the UELOGS work
except for the server function
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
ok Thank you ill see how it works
But yeah, if the TileRef doesn't make it to the Server, then that's usually cause it's not replicated.. hm
ok Thank you
is building shipping for the client and development for the server likely to cause any issues, do they have to match?
No, that's fine
how do I replicate it though?
its not declared in the player controller?
Yeah if the Actor is marked as replicated its hould already be.
Is there a BP of that Actor?
Is that maybe not marked as replicated for any reason?
wait so i can replicate it in the BP actor??
yeah there is an BP
it was giving me an error about that
still there?
:P I also have stuff to do, if I don't answer then I'm busy
understandable
Not sure I understand that question. What I mean is that if you have a BP Child of your Tile C++ Class, and you place that one, then you should double check that this BP Child has bReplicates actually set to true.
oh ok
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?
Ehhh, not entirely sure. That's potentially X RPCs, one per PlayerController Actor Channel, vs one RPC
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?
Don't use the Controller
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.
So where do I evaluate the bool
Wherever you want, probably whenever it is changed would be my guess
Bool change -> are all of them true? -> lets go
GameState would probably be the place with an onrepped variable for the game phase state
yeah I don't think I'm really grasping the concept here
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
So I have this state object, with an array of bools that the controllers access?
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
which is a seperate thing from the controller right
When that is changed, notify GameState and let GameState determine if it's ready to progress to the countdown or whatever
yes
so do I gotta make that or.....is it already in something
It's a built in class, you make a custom PlayerState just like you've already made a custom pawn and playercontroller etc
ugh thats like the 10th class I need for this lmao
I knew making a menu would be annoying but jeez
A custom playerstate, gamestate, gamemode, playercontroller, pawn are pretty much the basics
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
event begin play > random integer > array of meshes > set mesh
pretty sure that would work
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! 🙂
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.
ty
Didn't realize this. Datura's answer is better, mine would not prevent duplicates.
All replication consists of is going through the server and then multicast to all other clients?
Like: Client > Server > All Clients
@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.
Ahh ok
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.
Do you think what I have done with the pickups above is ok?
No.
What do you suggest I do?
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)
It is a pickup manager blueprint dropped in the world. So, checking if Has Authority or Is Server will be a better approach?