I’ve been messing with some local multiplayer stuff and thought I’d try with 1 client connecting to a Server Listener.
My PlayerController has a binding to the Start button on a gamepad. This is binded to the function JoinGame.
JoinGame gets the GameMode, then calls my custom function on there PlayerJoin() and passes it’s self through (as “this”).
My CustomGameMode has a function called PlayerJoin(PlayerController* controller), and I have this to store how many players, pawns, controllers there are.
In this function I also spanw a Character based on a custom blueprint and let the controller possess() it.
I was using the GameMode as a class to hold references to my custom Character Blueprint - so I could use that to spawn per player that joined.
This all worked locally, but on multiplayer doesnt make sense as GameMode exists only on Server, and the Client never knowns about it. (lots of errors)
What is the correct approach here?
Where should I be storing the different Character Blueprints?
My basic idea at this stage was just to do a simple 2 players in the world, 1 has picked CharacterA (which is a BP based on my custom Character.cpp) and the other player can pick CharacterB (also based off Character.cpp) - both Blueprints have slightly different properties (speed, jump height etc…)
Am I going about this all wrong? Should I be storing a reference to these Blueprint types somewhere else?
Or should I be using UFUNC(server/client) in someway?
I’ve seen there’s GameState - but it doesn’t sound like this is the correct place to hold this information.
Any pointers would be greatly appreciated !