Client side code only works for host in MP
I know this is (likely) the wrong way to do this, but I don't know the right way to go about it.
This doesn't need to be replicated at all, this is an entirely client-side bit of functionality.
This setup works for the MP host, but not for clients, and I'm not quite sure where to start with solving this.
Solution:Jump to solution
Should I mark this thread as solved and make a new one, seeing as I originally misdiagnosed the problem?
It's not that client side code doesn't execute, it's that custom bindings aren't working on a select number of keys for clients in a multiplayer session....
45 Replies
Where did you put that code?
I usually run keybind logic from a client-only subsystem
https://discord.com/channels/555424930502541343/601030071221878784/1285736187792851005
This one is in an actor (which will probably be it then)
But my other mod uses a subsystem to process the input and has the same issue, so IDK
Oh I just realised I am spawning that subsystem on the server
Is this for the train mod?
Gonna try that other mod with the subsystem set to client only, and if that works, I'll rework the orignal thing to also be client only
Yeh
For trains, you only need to create a mapping context and set its parent context to MC_Trains. THe context will be valid when the player possess a train
First person vehicles uses the subsystem, the train interiors mod still the input logic in an actor that gets spawned as a child actor of the train
That's all already in
If the keys are on the child actor you might have to add the mapping context manually, not sure about that
It worked for me as the host, I believe the problem is that things are set to replicate, testing with the subsystem right now
Yeah, I don't get what I'm doing wrong
This is in the Vehicle Camera Switch subsystem, spawned on client only, and yet it still only works for me as the host.
If another player joins me, with the same version of the mod installed, they cannot switch camera perspective, and there is no log output for any of this.
I know I have a different cast to node, that's because I couldn't get the one without the exec pins
(I'm also not sure it's strictly necessary)
What does setting that bool actually do? Where does your code get that value and make the change
That's the entire subsystem.
The bool gets called like this from another BP
This is probably an authority issue and you'll have to call or set something through an RCO for the clients to have the ability to make the change. It only works for the host (server) because they always have the authority
Multiplayer :: Satisfactory Modding Documentation
Although not all mods need special code to handle multiplayer, it’s important to create your mods with multiplayer in mind. Adding s...
Could it be because I'm changing the camera with a component that moves the camera?
The component is attached to the vehicles with an SCS hook
I've been to that page and I don't understand it.
I recommend logging both the server and client and see where the execution is failing for the client
Which parts do you not understand?
So both me and the person joining me got Server begin play here:
Just realised that that text in the log is entirely wrong for what I'm testing lmao
I was just inputting something
This one just doesn't work on the client
That is from a client only subsystem?
I think so
parent class is mod subsystem
How do I check to make sure?
This.. and it looks correct
Yeah
Works for me, doesn't work for clients
Then I have to assume the mapping context is not valid for the failing client
Any ideas on why?
I got nothing
Input Action and Mapping Context:
You might try logging this somewhere in the client subsystem, but I'm not sure what to trigger it from. The key event doesnt work and begin play is too early
Also, try switching parent contxt from MC_Vehicles to MC_Trains
Oh, sorry to clarify: this is for vehicle first person right now
(I only have a subsystem set up for that)
The train first person mod still isn't using a subsystem
Oh also the get display name for the player controller returns different IDs for both me, and the person joining my game
Ya, that's normal, each player has their own controller. Different actor different name.
That's what I'm saying
Different player controller, as expected
So why isn't the input working on clients?
No the client subsystem should spawn ForEach player, it should work for all of them.
But it doesn't though
So you dont see a begin play log for each client?
One sec, I'll try it one more time. resetting keybindings on the client
It seems to be related to the fact it's bound to V?
Ok this is weird, I believe it might be a conflict between vehicle first person and train first person
The client was now able to go into first person
lol classic keybind confilct
Try checking ReserveAllMappings in the input action
WHAT???
Ok
So
It's V specifically that doesn't work on clients
Some other keys work
Yes
Ok so the host can set any key, clients can only set keys not used in other contexts
V and B don't work
V is bound to SetPath in the parent (MC_Vehicles). You cannot override the parent. If you insist on using that key, you'll have to null the parent context, add the mapping context manually, and give it a higher priority
I think F worked (person I'm testing with is AFK and I forgor)
Default is N, the client rebound set path
And again, it works for the host if you do the rebinding
The client rebound Set Path to N and change perspective to V
That does not work
Set path on V and change perspective on N does work
Both work for the host
V is also the scanner, maybe that's why?
But still, why does it work for the host and not clients?
Thats a player action bind, and should be overriden when in vehicles
I don't know, never encountered that before.
hmm
Switched the train mod over to a subsystem, that now works as well, but has the same issue where keys like V and B don't work
I still think it may have something to do with the fact that those keys are used on foot
I still have absolutely no clue what could be causing this still, if anyone's got any ideas, feel free to tell me, I'm happy to hear any suggestions
Solution
Should I mark this thread as solved and make a new one, seeing as I originally misdiagnosed the problem?
It's not that client side code doesn't execute, it's that custom bindings aren't working on a select number of keys for clients in a multiplayer session.